void OpenAssemblies(ILSpySettings spySettings) { HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments); if (App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) { SharpTreeNode node = null; if (sessionSettings.ActiveTreeViewPath != null) { node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); if (node == this.assemblyListTreeNode && sessionSettings.ActiveAutoLoadedAssembly != null) { node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); } } if (node != null) { SelectNode(node); // only if not showing the about page, perform the update check: ShowMessageIfUpdatesAvailableAsync(spySettings); } else { AboutPage.Display(decompilerTextView); } } AvalonEditTextOutput output = new AvalonEditTextOutput(); if (FormatExceptions(App.StartupExceptions.ToArray(), output)) { decompilerTextView.ShowText(output); } }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { ILSpySettings spySettings = this.spySettings; this.spySettings = null; // Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff. // This makes the UI come up a bit faster. this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList); HandleCommandLineArguments(App.CommandLineArguments); if (assemblyList.GetAssemblies().Length == 0 && assemblyList.ListName == AssemblyListManager.DefaultListName) { LoadInitialAssemblies(); } ShowAssemblyList(this.assemblyList); HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments); if (App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) { SharpTreeNode node = null; if (sessionSettings.ActiveTreeViewPath != null) { node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); if (node == this.assemblyListTreeNode && sessionSettings.ActiveAutoLoadedAssembly != null) { this.assemblyList.Open(sessionSettings.ActiveAutoLoadedAssembly, true); node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); } } if (node != null) { SelectNode(node); // only if not showing the about page, perform the update check: ShowMessageIfUpdatesAvailableAsync(spySettings); } else { AboutPage.Display(decompilerTextView); } } AvalonEditTextOutput output = new AvalonEditTextOutput(); if (FormatExceptions(App.StartupExceptions.ToArray(), output)) { decompilerTextView.ShowText(output); } }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { ILSpySettings spySettings = this.spySettings; this.spySettings = null; // Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff. // This makes the UI come up a bit faster. this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList); HandleCommandLineArguments(App.CommandLineArguments); if (assemblyList.GetAssemblies().Length == 0 && assemblyList.ListName == AssemblyListManager.DefaultListName) { LoadInitialAssemblies(); } ShowAssemblyList(this.assemblyList); HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments); if (App.CommandLineArguments.NavigateTo == null) { SharpTreeNode node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); if (node != null) { SelectNode(node); // only if not showing the about page, perform the update check: ShowMessageIfUpdatesAvailableAsync(spySettings); } else { AboutPage.Display(decompilerTextView); } } //Fires the OnLoaded notification to the plugins foreach (var x in applicationLifeCycleInterceptors) { x.Value.OnLoaded(); } }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { ILSpySettings spySettings = this.spySettings; this.spySettings = null; // Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff. // This makes the UI come up a bit faster. this.assemblyList = assemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList); ShowAssemblyList(this.assemblyList); string[] args = Environment.GetCommandLineArgs(); for (int i = 1; i < args.Length; i++) { assemblyList.OpenAssembly(args[i]); } if (assemblyList.GetAssemblies().Length == 0) { LoadInitialAssemblies(); } SharpTreeNode node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); if (node != null) { SelectNode(node); // only if not showing the about page, perform the update check: ShowMessageIfUpdatesAvailableAsync(spySettings); } else { AboutPage.Display(decompilerTextView); } }
async void NavigateOnLaunch(string navigateTo, string[] activeTreeViewPath, ILSpySettings spySettings, List <LoadedAssembly> relevantAssemblies) { var initialSelection = treeView.SelectedItem; if (navigateTo != null) { bool found = false; if (navigateTo.StartsWith("N:", StringComparison.Ordinal)) { string namespaceName = navigateTo.Substring(2); foreach (LoadedAssembly asm in relevantAssemblies) { AssemblyTreeNode asmNode = assemblyListTreeNode.FindAssemblyNode(asm); if (asmNode != null) { // FindNamespaceNode() blocks the UI if the assembly is not yet loaded, // so use an async wait instead. await asm.GetPEFileAsync().Catch <Exception>(ex => { }); NamespaceTreeNode nsNode = asmNode.FindNamespaceNode(namespaceName); if (nsNode != null) { found = true; if (treeView.SelectedItem == initialSelection) { SelectNode(nsNode); } break; } } } } else if (navigateTo == "none") { // Don't navigate anywhere; start empty. // Used by ILSpy VS addin, it'll send us the real location to navigate to via IPC. found = true; } else { IEntity mr = await Task.Run(() => FindEntityInRelevantAssemblies(navigateTo, relevantAssemblies)); if (mr != null && mr.ParentModule.PEFile != null) { found = true; if (treeView.SelectedItem == initialSelection) { JumpToReference(mr); } } } if (!found && treeView.SelectedItem == initialSelection) { AvalonEditTextOutput output = new AvalonEditTextOutput(); output.Write(string.Format("Cannot find '{0}' in command line specified assemblies.", navigateTo)); decompilerTextView.ShowText(output); } } else if (relevantAssemblies.Count == 1) { // NavigateTo == null and an assembly was given on the command-line: // Select the newly loaded assembly AssemblyTreeNode asmNode = assemblyListTreeNode.FindAssemblyNode(relevantAssemblies[0]); if (asmNode != null && treeView.SelectedItem == initialSelection) { SelectNode(asmNode); } } else if (spySettings != null) { SharpTreeNode node = null; if (activeTreeViewPath?.Length > 0) { foreach (var asm in assemblyList.GetAssemblies()) { if (asm.FileName == activeTreeViewPath[0]) { // FindNodeByPath() blocks the UI if the assembly is not yet loaded, // so use an async wait instead. await asm.GetPEFileAsync().Catch <Exception>(ex => { }); } } node = FindNodeByPath(activeTreeViewPath, true); } if (treeView.SelectedItem == initialSelection) { if (node != null) { SelectNode(node); // only if not showing the about page, perform the update check: await ShowMessageIfUpdatesAvailableAsync(spySettings); } else { AboutPage.Display(decompilerTextView); } } } }