From ddba315a0af48f8fbdea3c9de8db9a651ddf94ab Mon Sep 17 00:00:00 2001 From: wangzq Date: Wed, 26 Dec 2018 01:29:50 -0800 Subject: [PATCH] Add command line argument "/config:" to specify settings file --- ILSpy/CommandLineArguments.cs | 3 +++ ILSpy/ILSpySettings.cs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ILSpy/CommandLineArguments.cs b/ILSpy/CommandLineArguments.cs index 4ee5c1af2..f0a05015f 100644 --- a/ILSpy/CommandLineArguments.cs +++ b/ILSpy/CommandLineArguments.cs @@ -30,6 +30,7 @@ namespace ICSharpCode.ILSpy public string Search; public string Language; public bool NoActivate; + public string ConfigFile; public CommandLineArguments(IEnumerable arguments) { @@ -49,6 +50,8 @@ namespace ICSharpCode.ILSpy this.Language = arg.Substring("/language:".Length); else if (arg.Equals("/noActivate", StringComparison.OrdinalIgnoreCase)) this.NoActivate = true; + else if (arg.StartsWith("/config:", StringComparison.OrdinalIgnoreCase)) + this.ConfigFile = arg.Substring("/config:".Length); } else { this.AssembliesToLoad.Add(arg); } diff --git a/ILSpy/ILSpySettings.cs b/ILSpy/ILSpySettings.cs index 781c3f978..54382b132 100644 --- a/ILSpy/ILSpySettings.cs +++ b/ILSpy/ILSpySettings.cs @@ -114,6 +114,8 @@ namespace ICSharpCode.ILSpy static string GetConfigFile() { + if (App.CommandLineArguments.ConfigFile != null) + return App.CommandLineArguments.ConfigFile; string localPath = Path.Combine(Path.GetDirectoryName(typeof(MainWindow).Assembly.Location), "ILSpy.xml"); if (File.Exists(localPath)) return localPath;