Browse Source

Fix switching to newly created/cloned assembly list.

pull/1866/head
Siegfried Pammer 6 years ago
parent
commit
70e1053c0a
  1. 11
      ILSpy/AssemblyListManager.cs
  2. 6
      ILSpy/MainWindow.xaml.cs

11
ILSpy/AssemblyListManager.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.ILSpy
/// </summary> /// </summary>
sealed class AssemblyListManager sealed class AssemblyListManager
{ {
readonly ILSpySettings spySettings; ILSpySettings spySettings;
public AssemblyListManager(ILSpySettings spySettings) public AssemblyListManager(ILSpySettings spySettings)
{ {
@ -47,8 +47,9 @@ namespace ICSharpCode.ILSpy
/// Loads an assembly list from the ILSpySettings. /// Loads an assembly list from the ILSpySettings.
/// If no list with the specified name is found, the default list is loaded instead. /// If no list with the specified name is found, the default list is loaded instead.
/// </summary> /// </summary>
public AssemblyList LoadList(string listName) public AssemblyList LoadList(ILSpySettings settings, string listName)
{ {
this.spySettings = settings;
AssemblyList list = DoLoadList(spySettings, listName); AssemblyList list = DoLoadList(spySettings, listName);
if (!AssemblyLists.Contains(list.ListName)) if (!AssemblyLists.Contains(list.ListName))
AssemblyLists.Add(list.ListName); AssemblyLists.Add(list.ListName);
@ -65,11 +66,7 @@ namespace ICSharpCode.ILSpy
} }
} }
} }
XElement firstList = doc.Elements("List").FirstOrDefault(); return new AssemblyList(listName ?? DefaultListName);
if (firstList != null)
return new AssemblyList(firstList);
else
return new AssemblyList(listName ?? DefaultListName);
} }
public bool CloneList(string selectedAssemblyList, string newListName) public bool CloneList(string selectedAssemblyList, string newListName)

6
ILSpy/MainWindow.xaml.cs

@ -477,7 +477,7 @@ namespace ICSharpCode.ILSpy
if (loadPreviousAssemblies) { if (loadPreviousAssemblies) {
// Load AssemblyList only in Loaded event so that WPF is initialized before we start the CPU-heavy stuff. // 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 makes the UI come up a bit faster.
this.assemblyList = AssemblyListManager.LoadList(sessionSettings.ActiveAssemblyList); this.assemblyList = AssemblyListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
} else { } else {
this.assemblyList = new AssemblyList(AssemblyListManager.DefaultListName); this.assemblyList = new AssemblyList(AssemblyListManager.DefaultListName);
AssemblyListManager.ClearAll(); AssemblyListManager.ClearAll();
@ -595,7 +595,7 @@ namespace ICSharpCode.ILSpy
public void ShowAssemblyList(string name) public void ShowAssemblyList(string name)
{ {
AssemblyList list = this.AssemblyListManager.LoadList(name); AssemblyList list = this.AssemblyListManager.LoadList(ILSpySettings.Load(), name);
//Only load a new list when it is a different one //Only load a new list when it is a different one
if (list.ListName != CurrentAssemblyList.ListName) { if (list.ListName != CurrentAssemblyList.ListName) {
ShowAssemblyList(list); ShowAssemblyList(list);
@ -916,7 +916,7 @@ namespace ICSharpCode.ILSpy
try { try {
refreshInProgress = true; refreshInProgress = true;
var path = GetPathForNode(treeView.SelectedItem as SharpTreeNode); var path = GetPathForNode(treeView.SelectedItem as SharpTreeNode);
ShowAssemblyList(AssemblyListManager.LoadList(assemblyList.ListName)); ShowAssemblyList(AssemblyListManager.LoadList(ILSpySettings.Load(), assemblyList.ListName));
SelectNode(FindNodeByPath(path, true)); SelectNode(FindNodeByPath(path, true));
} finally { } finally {
refreshInProgress = false; refreshInProgress = false;

Loading…
Cancel
Save