From d43d4785cb9b7d571f13d4009e52da87addffbb3 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 27 Sep 2019 18:21:52 +0200 Subject: [PATCH] #1711: Support /navigateTo:none on command-line to disable the automatic navigation on startup. --- ILSpy/MainWindow.xaml.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index 4563dd602d..594cb4f2c0 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -323,6 +323,10 @@ async void NavigateOnLaunch(string navigateTo, string[] activeTreeViewPath, ILSp } } } + } 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) { @@ -346,15 +350,15 @@ async void NavigateOnLaunch(string navigateTo, string[] activeTreeViewPath, ILSp } } else if (spySettings != null) { SharpTreeNode node = null; - if (sessionSettings.ActiveTreeViewPath?.Length > 0) { + if (activeTreeViewPath?.Length > 0) { foreach (var asm in assemblyList.GetAssemblies()) { - if (asm.FileName == sessionSettings.ActiveTreeViewPath[0]) { + 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(ex => { }); } } - node = FindNodeByPath(sessionSettings.ActiveTreeViewPath, true); + node = FindNodeByPath(activeTreeViewPath, true); } if (treeView.SelectedItem == initialSelection) { if (node != null) {