Forge
csharpdeeb25a2
1#nullable enable
2using CascadeIDE.Contracts;
3
4namespace CascadeIDE.Cockpit.ComputingUnits.Launch;
5
6/// <summary>Общие шаги: путь к .csproj, карта <see cref="LaunchProfileData"/> в <see cref="DebugLaunchResolution"/> (ADR 0090).</summary>
7[ComputingUnit]
8public static class DebugLaunchFromProfile
9{
10 /// <summary>
11 /// Тот же <see cref="IReadOnlyDictionary{TKey, TValue}"/>, что в профиле, или <c>null</c>, если словарь пустой
12 /// (DAP/браузер: как при F5, без пустой обёртки).
13 /// </summary>
14 public static IReadOnlyDictionary<string, string>? NonEmptyEnvironmentOrNull(LaunchProfileData prof) =>
15 prof.Environment is { Count: > 0 } d ? d : null;
16
17 public static DebugLaunchResolution ToResolution(LaunchProfileData profile, string targetDllPath) =>
18 new(
19 targetDllPath,
20 profile.ProgramArgs is { Count: > 0 } ? profile.ProgramArgs : null,
21 NonEmptyEnvironmentOrNull(profile),
22 string.IsNullOrEmpty(profile.WorkingDirectoryRelative) ? null : profile.WorkingDirectoryRelative,
23 profile.OpenLaunchBrowser,
24 profile.LaunchUrl);
25}
26
View only · write via MCP/CIDE