Browse Source

Add option to not reload assemblies

pull/1409/head
Edward Cooke 7 years ago
parent
commit
660d8ca17a
  1. 17
      ILSpy/MainWindow.xaml.cs
  2. 14
      ILSpy/Options/MiscSettings.cs
  3. 1
      ILSpy/Options/MiscSettingsPanel.xaml
  4. 3
      ILSpy/Options/MiscSettingsPanel.xaml.cs

17
ILSpy/MainWindow.xaml.cs

@ -362,15 +362,22 @@ namespace ICSharpCode.ILSpy
{
ILSpySettings spySettings = this.spySettings;
this.spySettings = null;
var loadPreviousAssemblies = Options.MiscSettingsPanel.CurrentMiscSettings.LoadPreviousAssemblies;
// 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);
if (loadPreviousAssemblies) {
// 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);
} else {
this.assemblyList = new AssemblyList(AssemblyListManager.DefaultListName);
assemblyListManager.ClearAll();
}
HandleCommandLineArguments(App.CommandLineArguments);
if (assemblyList.GetAssemblies().Length == 0
&& assemblyList.ListName == AssemblyListManager.DefaultListName) {
&& assemblyList.ListName == AssemblyListManager.DefaultListName
&& loadPreviousAssemblies) {
LoadInitialAssemblies();
}
@ -731,7 +738,7 @@ namespace ICSharpCode.ILSpy
OpenFiles(dlg.FileNames);
}
}
public void OpenFiles(string[] fileNames, bool focusNode = true)
{
if (fileNames == null)

14
ILSpy/Options/MiscSettings.cs

@ -24,6 +24,7 @@ namespace ICSharpCode.ILSpy.Options
public class MiscSettings : INotifyPropertyChanged
{
bool allowMultipleInstances;
bool loadPreviousAssemblies;
/// <summary>
/// Allow multiple instances.
@ -39,6 +40,19 @@ namespace ICSharpCode.ILSpy.Options
}
}
/// <summary>
/// Load assemblies that were loaded in the previous instance
/// </summary>
public bool LoadPreviousAssemblies {
get { return loadPreviousAssemblies; }
set {
if (loadPreviousAssemblies != value) {
loadPreviousAssemblies = value;
OnPropertyChanged();
}
}
}
#region INotifyPropertyChanged Implementation
public event PropertyChangedEventHandler PropertyChanged;

1
ILSpy/Options/MiscSettingsPanel.xaml

@ -7,5 +7,6 @@
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel Margin="10">
<CheckBox IsChecked="{Binding AllowMultipleInstances}">Allow multiple instances</CheckBox>
<CheckBox IsChecked="{Binding LoadPreviousAssemblies}">Load assemblies that were loaded in the last instance.</CheckBox>
</StackPanel>
</UserControl>

3
ILSpy/Options/MiscSettingsPanel.xaml.cs

@ -50,6 +50,8 @@ namespace ICSharpCode.ILSpy.Options
XElement e = settings["MiscSettings"];
var s = new MiscSettings();
s.AllowMultipleInstances = (bool?)e.Attribute("AllowMultipleInstances") ?? false;
s.LoadPreviousAssemblies = (bool?)e.Attribute(nameof(s.LoadPreviousAssemblies)) ?? true;
return s;
}
@ -59,6 +61,7 @@ namespace ICSharpCode.ILSpy.Options
var section = new XElement("MiscSettings");
section.SetAttributeValue("AllowMultipleInstances", s.AllowMultipleInstances);
section.SetAttributeValue(nameof(s.LoadPreviousAssemblies), s.LoadPreviousAssemblies);
XElement existingElement = root.Element("MiscSettings");
if (existingElement != null)

Loading…
Cancel
Save