private static void AddBaseLaunchOptionsElements(StringBuilder xmlLaunchOptions, JsonBaseLaunchOptions jsonLaunchOptions) { if (jsonLaunchOptions.SetupCommands != null) { xmlLaunchOptions.Append(" <SetupCommands>\n"); foreach (JsonCommand command in jsonLaunchOptions.SetupCommands) { xmlLaunchOptions.Append(FormatCommand(command)); } xmlLaunchOptions.Append(" </SetupCommands>\n"); } if (jsonLaunchOptions.CustomLaunchSetupCommands != null) { xmlLaunchOptions.Append(" <CustomLaunchSetupCommands>\n"); foreach (JsonCommand command in jsonLaunchOptions.CustomLaunchSetupCommands) { xmlLaunchOptions.Append(FormatCommand(command)); } xmlLaunchOptions.Append(" </CustomLaunchSetupCommands>\n"); } if (!String.IsNullOrEmpty(jsonLaunchOptions.LaunchCompleteCommand)) { // The xml schema will validate the allowable values. xmlLaunchOptions.Append(String.Format(CultureInfo.InvariantCulture, " <LaunchCompleteCommand>{0}</LaunchCompleteCommand>\n", jsonLaunchOptions.LaunchCompleteCommand)); } }
private static void AddBaseLaunchOptionsAttributes( StringBuilder xmlLaunchOptions, JsonBaseLaunchOptions jsonLaunchOptions, string program, string workingDirectory) { xmlLaunchOptions.Append(String.Concat(" ExePath='", XmlSingleQuotedAttributeEncode(program), "'\n")); if (!String.IsNullOrEmpty(workingDirectory)) { xmlLaunchOptions.Append(String.Concat(" WorkingDirectory='", XmlSingleQuotedAttributeEncode(workingDirectory), "'\n")); } if (jsonLaunchOptions.TargetArchitecture != null) { xmlLaunchOptions.Append(String.Concat(" TargetArchitecture='", jsonLaunchOptions.TargetArchitecture, "'\n")); } if (jsonLaunchOptions.VisualizerFile != null) { xmlLaunchOptions.Append(String.Concat(" VisualizerFile='", jsonLaunchOptions.VisualizerFile, "'\n")); } if (jsonLaunchOptions.ShowDisplayString) { xmlLaunchOptions.Append(" ShowDisplayString='true'\n"); } if (jsonLaunchOptions.AdditionalSOLibSearchPath != null) { xmlLaunchOptions.Append(String.Concat(" AdditionalSOLibSearchPath='", jsonLaunchOptions.AdditionalSOLibSearchPath, "'\n")); } if (!String.IsNullOrWhiteSpace(jsonLaunchOptions.CoreDumpPath)) { xmlLaunchOptions.Append(String.Concat(" CoreDumpPath='", jsonLaunchOptions.CoreDumpPath, "'\n")); } string[] exeArgsArray = jsonLaunchOptions.Args; // Check to see if we need to redirect app stdin/out/err in Windows case for IntegratedTerminalSupport. if (Utilities.IsWindows() && HostRunInTerminal.IsRunInTerminalAvailable() && jsonLaunchOptions is JsonLocalLaunchOptions && String.IsNullOrWhiteSpace(jsonLaunchOptions.CoreDumpPath)) { var localLaunchOptions = (JsonLocalLaunchOptions)jsonLaunchOptions; if (localLaunchOptions.ProcessId == 0 && // Only when launching the debuggee !localLaunchOptions.ExternalConsole && !localLaunchOptions.AvoidWindowsConsoleRedirection) { exeArgsArray = TryAddWindowsDebuggeeConsoleRedirection(exeArgsArray); } } // ExeArguments // Build the exe's argument list as a string StringBuilder exeArguments = new StringBuilder(); exeArguments.Append(CreateArgumentList(exeArgsArray)); XmlSingleQuotedAttributeEncode(exeArguments); xmlLaunchOptions.Append(String.Concat(" ExeArguments='", exeArguments, "'\n")); if (jsonLaunchOptions.MIMode != null) { xmlLaunchOptions.Append(String.Concat(" MIMode='", jsonLaunchOptions.MIMode, "'\n")); } }