Browse Source

Remove saveDir and fixedGuid command line arguments: Please use ICSharpCode.Decompiler.Console instead.

pull/1012/head
Siegfried Pammer 8 years ago
parent
commit
f77ee4fc35
  1. 11
      ILSpy/CommandLineArguments.cs
  2. 1
      ILSpy/Languages/CSharpLanguage.cs
  3. 35
      ILSpy/MainWindow.xaml.cs

11
ILSpy/CommandLineArguments.cs

@ -30,8 +30,6 @@ namespace ICSharpCode.ILSpy @@ -30,8 +30,6 @@ namespace ICSharpCode.ILSpy
public string Search;
public string Language;
public bool NoActivate;
public Guid? FixedGuid;
public string SaveDirectory;
public CommandLineArguments(IEnumerable<string> arguments)
{
@ -51,15 +49,6 @@ namespace ICSharpCode.ILSpy @@ -51,15 +49,6 @@ namespace ICSharpCode.ILSpy
this.Language = arg.Substring("/language:".Length);
else if (arg.Equals("/noActivate", StringComparison.OrdinalIgnoreCase))
this.NoActivate = true;
else if (arg.StartsWith("/fixedGuid:", StringComparison.OrdinalIgnoreCase)) {
string guid = arg.Substring("/fixedGuid:".Length);
if (guid.Length < 32)
guid = guid + new string('0', 32 - guid.Length);
Guid fixedGuid;
if (Guid.TryParse(guid, out fixedGuid))
this.FixedGuid = fixedGuid;
} else if (arg.StartsWith("/saveDir:", StringComparison.OrdinalIgnoreCase))
this.SaveDirectory = arg.Substring("/saveDir:".Length);
} else {
this.AssembliesToLoad.Add(arg);
}

1
ILSpy/Languages/CSharpLanguage.cs

@ -325,7 +325,6 @@ namespace ICSharpCode.ILSpy @@ -325,7 +325,6 @@ namespace ICSharpCode.ILSpy
var module = assembly.GetModuleDefinitionAsync().Result;
if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
var decompiler = new ILSpyWholeProjectDecompiler(assembly, options);
decompiler.ProjectGuid = App.CommandLineArguments.FixedGuid;
decompiler.DecompileProject(module, options.SaveAsProjectDirectory, new TextOutputWriter(output), options.CancellationToken);
} else {
AddReferenceWarningMessage(module.Assembly, output);

35
ILSpy/MainWindow.xaml.cs

@ -254,15 +254,9 @@ namespace ICSharpCode.ILSpy @@ -254,15 +254,9 @@ namespace ICSharpCode.ILSpy
return true;
}
async void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args)
void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args)
{
// if a SaveDirectory is given, do not start a second concurrent decompilation
// by executing JumpoToReference (leads to https://github.com/icsharpcode/ILSpy/issues/710)
if (!string.IsNullOrEmpty(args.SaveDirectory)) {
var tasks = commandLineLoadedAssemblies.Select(a => a.GetModuleDefinitionAsync()).ToArray();
var modules = await Task.WhenAll(tasks);
ExportAssemblies(modules, args.SaveDirectory);
} else if (args.NavigateTo != null) {
if (args.NavigateTo != null) {
bool found = false;
if (args.NavigateTo.StartsWith("N:", StringComparison.Ordinal)) {
string namespaceName = args.NavigateTo.Substring(2);
@ -308,29 +302,6 @@ namespace ICSharpCode.ILSpy @@ -308,29 +302,6 @@ namespace ICSharpCode.ILSpy
commandLineLoadedAssemblies.Clear(); // clear references once we don't need them anymore
}
void ExportAssemblies(ModuleDefinition[] modules, string path)
{
Language language = sessionSettings.FilterSettings.Language;
TextView.SaveAssembliesToDisk(language, modules.Select(m => assemblyListTreeNode.FindAssemblyNode(m)).Where(m => m != null).ToArray(), path);
}
void OnExportAssembly(Task<ModuleDefinition> moduleTask, string path)
{
AssemblyTreeNode asmNode = assemblyListTreeNode.FindAssemblyNode(moduleTask.Result);
if (asmNode != null) {
string file = DecompilerTextView.CleanUpName(asmNode.LoadedAssembly.ShortName);
Language language = sessionSettings.FilterSettings.Language;
DecompilationOptions options = new DecompilationOptions();
options.FullDecompilation = true;
options.SaveAsProjectDirectory = Path.Combine(path, file);
if (!Directory.Exists(options.SaveAsProjectDirectory)) {
Directory.CreateDirectory(options.SaveAsProjectDirectory);
}
string fullFile = Path.Combine(options.SaveAsProjectDirectory, file + language.ProjectFileExtension);
TextView.SaveToDisk(language, new[] { asmNode }, options, fullFile);
}
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ILSpySettings spySettings = this.spySettings;
@ -359,7 +330,7 @@ namespace ICSharpCode.ILSpy @@ -359,7 +330,7 @@ namespace ICSharpCode.ILSpy
void OpenAssemblies(ILSpySettings spySettings)
{
HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments);
if (string.IsNullOrEmpty(App.CommandLineArguments.SaveDirectory) && App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) {
if (App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) {
SharpTreeNode node = null;
if (sessionSettings.ActiveTreeViewPath != null) {
node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true);

Loading…
Cancel
Save