Browse Source

Add command line argument "/config:" to specify settings file

pull/1360/head
wangzq 7 years ago
parent
commit
ddba315a0a
  1. 3
      ILSpy/CommandLineArguments.cs
  2. 2
      ILSpy/ILSpySettings.cs

3
ILSpy/CommandLineArguments.cs

@ -30,6 +30,7 @@ namespace ICSharpCode.ILSpy
public string Search; public string Search;
public string Language; public string Language;
public bool NoActivate; public bool NoActivate;
public string ConfigFile;
public CommandLineArguments(IEnumerable<string> arguments) public CommandLineArguments(IEnumerable<string> arguments)
{ {
@ -49,6 +50,8 @@ namespace ICSharpCode.ILSpy
this.Language = arg.Substring("/language:".Length); this.Language = arg.Substring("/language:".Length);
else if (arg.Equals("/noActivate", StringComparison.OrdinalIgnoreCase)) else if (arg.Equals("/noActivate", StringComparison.OrdinalIgnoreCase))
this.NoActivate = true; this.NoActivate = true;
else if (arg.StartsWith("/config:", StringComparison.OrdinalIgnoreCase))
this.ConfigFile = arg.Substring("/config:".Length);
} else { } else {
this.AssembliesToLoad.Add(arg); this.AssembliesToLoad.Add(arg);
} }

2
ILSpy/ILSpySettings.cs

@ -114,6 +114,8 @@ namespace ICSharpCode.ILSpy
static string GetConfigFile() static string GetConfigFile()
{ {
if (App.CommandLineArguments.ConfigFile != null)
return App.CommandLineArguments.ConfigFile;
string localPath = Path.Combine(Path.GetDirectoryName(typeof(MainWindow).Assembly.Location), "ILSpy.xml"); string localPath = Path.Combine(Path.GetDirectoryName(typeof(MainWindow).Assembly.Location), "ILSpy.xml");
if (File.Exists(localPath)) if (File.Exists(localPath))
return localPath; return localPath;

Loading…
Cancel
Save