.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.8 KiB

using System;
using ICSharpCode.Decompiler;
using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpy.ViewModels;
using ICSharpCode.ILSpyX;
using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy.Util
{
public class SettingsService
{
public static readonly SettingsService Instance = new();
private SettingsService()
{
SpySettings = ILSpySettings.Load();
SessionSettings = new(SpySettings);
DecompilerSettings = DecompilerSettingsPanel.LoadDecompilerSettings(SpySettings);
DisplaySettings = DisplaySettingsPanel.LoadDisplaySettings(SpySettings, SessionSettings);
MiscSettings = MiscSettings.Load(SpySettings);
AssemblyListManager = new(SpySettings) {
ApplyWinRTProjections = DecompilerSettings.ApplyWindowsRuntimeProjections,
UseDebugSymbols = DecompilerSettings.UseDebugSymbols
};
}
public ILSpySettings SpySettings { get; }
public SessionSettings SessionSettings { get; }
public DecompilerSettings DecompilerSettings { get; set; }
public DisplaySettings DisplaySettings { get; }
public MiscSettings MiscSettings { get; set; }
public AssemblyListManager AssemblyListManager { get; }
public DecompilationOptions CreateDecompilationOptions(TabPageModel tabPage)
{
return new(SessionSettings.LanguageSettings.LanguageVersion, DecompilerSettings, DisplaySettings) { Progress = tabPage.Content as IProgress<DecompilationProgress> };
}
public AssemblyList LoadInitialAssemblyList()
{
var loadPreviousAssemblies = MiscSettings.LoadPreviousAssemblies;
if (loadPreviousAssemblies)
{
return AssemblyListManager.LoadList(SessionSettings.ActiveAssemblyList);
}
else
{
AssemblyListManager.ClearAll();
return AssemblyListManager.CreateList(AssemblyListManager.DefaultListName);
}
}
}
}