diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilCommandLine.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilCommandLine.cs index 5cc6c8780a..3e1762be87 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilCommandLine.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilCommandLine.cs @@ -24,7 +24,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference { public class SvcUtilCommandLine { - StringBuilder argumentBuilder = new StringBuilder(); + List arguments = new List(); public SvcUtilCommandLine(ServiceReferenceGeneratorOptions options) { @@ -32,7 +32,11 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference } public string Command { get; set; } - public string Arguments { get; private set; } + + public string[] GetArguments() + { + return arguments.ToArray(); + } void GenerateCommandLine(ServiceReferenceGeneratorOptions options) { @@ -48,8 +52,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference AppendIfNotEmpty("/ct:", options.GetDictionaryCollectionTypeDescription()); AppendAssemblyReferences(options.Assemblies); AppendIfNotEmpty(options.Url); - - this.Arguments = argumentBuilder.ToString(); } void AppendIfTrue(string argument, bool flag) @@ -62,7 +64,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference void AppendIfNotEmpty(string argumentName, string argumentValue) { if (!String.IsNullOrEmpty(argumentValue)) { - Append(argumentName + GetQuotedArgument(argumentValue)); + Append(argumentName + argumentValue); } } @@ -75,29 +77,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference void Append(string argument) { - argumentBuilder.Append(argument); - argumentBuilder.Append(' '); - } - - public override string ToString() - { - return String.Format( - "{0} {1}", - GetQuotedCommand(), - Arguments); - } - - string GetQuotedCommand() - { - return GetQuotedArgument(Command); - } - - string GetQuotedArgument(string argument) - { - if (ContainsSpaceCharacter(argument)) { - return String.Format("\"{0}\"", argument); - } - return argument; + arguments.Add(argument); } bool ContainsSpaceCharacter(string text) diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilRunner.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilRunner.cs index ad54add75e..c18949da6d 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilRunner.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/SvcUtilRunner.cs @@ -40,7 +40,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference var commandLine = new SvcUtilCommandLine(Options); commandLine.Command = GetSvcUtilPath(); using (ProcessRunner processRunner = new ProcessRunner()) { - this.ExitCode = await processRunner.RunInOutputPadAsync(SvcUtilMessageView.Category, commandLine.Command, ProcessRunner.CommandLineToArgumentArray(commandLine.Arguments)); + this.ExitCode = await processRunner.RunInOutputPadAsync(SvcUtilMessageView.Category, commandLine.Command, commandLine.GetArguments()); } if (ProcessExited != null) { ProcessExited(this, new EventArgs()); diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReferenceHelper.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReferenceHelper.cs index fdde3ea3f4..e88a1aa5d1 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReferenceHelper.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReferenceHelper.cs @@ -24,12 +24,12 @@ using System.Web.Services.Discovery; namespace ICSharpCode.SharpDevelop.Gui { internal static class ServiceReferenceHelper - { + { public static string GetServiceName(ServiceDescription description) { if (description.Name != null) { return description.Name; - } else if (description.RetrievalUrl != null) { + } else if (!String.IsNullOrEmpty(description.RetrievalUrl)) { Uri uri = new Uri(description.RetrievalUrl); if (uri.Segments.Length > 0) { return uri.Segments[uri.Segments.Length - 1];