|
|
|
@ -24,6 +24,7 @@ using System.Text;
@@ -24,6 +24,7 @@ using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
|
using System.Windows; |
|
|
|
|
using System.Xml.Linq; |
|
|
|
|
using ICSharpCode.ILSpy.Docking; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.ILSpy |
|
|
|
|
{ |
|
|
|
@ -36,53 +37,57 @@ namespace ICSharpCode.ILSpy
@@ -36,53 +37,57 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
public SessionSettings(ILSpySettings spySettings) |
|
|
|
|
{ |
|
|
|
|
XElement doc = spySettings["SessionSettings"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XElement filterSettings = doc.Element("FilterSettings"); |
|
|
|
|
if (filterSettings == null) filterSettings = new XElement("FilterSettings"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.FilterSettings = new FilterSettings(filterSettings); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ActiveAssemblyList = (string)doc.Element("ActiveAssemblyList"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XElement activeTreeViewPath = doc.Element("ActiveTreeViewPath"); |
|
|
|
|
if (activeTreeViewPath != null) { |
|
|
|
|
this.ActiveTreeViewPath = activeTreeViewPath.Elements().Select(e => Unescape((string)e)).ToArray(); |
|
|
|
|
} |
|
|
|
|
this.ActiveAutoLoadedAssembly = (string)doc.Element("ActiveAutoLoadedAssembly"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.WindowState = FromString((string)doc.Element("WindowState"), WindowState.Normal); |
|
|
|
|
this.WindowBounds = FromString((string)doc.Element("WindowBounds"), DefaultWindowBounds); |
|
|
|
|
this.SplitterPosition = FromString((string)doc.Element("SplitterPosition"), 0.4); |
|
|
|
|
this.TopPaneSplitterPosition = FromString((string)doc.Element("TopPaneSplitterPosition"), 0.3); |
|
|
|
|
this.BottomPaneSplitterPosition = FromString((string)doc.Element("BottomPaneSplitterPosition"), 0.3); |
|
|
|
|
this.SelectedSearchMode = FromString((string)doc.Element("SelectedSearchMode"), SearchMode.TypeAndMember); |
|
|
|
|
|
|
|
|
|
this.DockLayout = new DockLayoutSettings(doc.Element("DockLayout")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnPropertyChanged(string propertyName) |
|
|
|
|
{ |
|
|
|
|
if (PropertyChanged != null) |
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FilterSettings FilterSettings { get; private set; } |
|
|
|
|
public SearchMode SelectedSearchMode { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string[] ActiveTreeViewPath; |
|
|
|
|
public string ActiveAutoLoadedAssembly; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string ActiveAssemblyList; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WindowState WindowState = WindowState.Normal; |
|
|
|
|
public Rect WindowBounds; |
|
|
|
|
internal static Rect DefaultWindowBounds = new Rect(10, 10, 750, 550); |
|
|
|
|
internal static Rect DefaultWindowBounds = new Rect(10, 10, 750, 550); |
|
|
|
|
/// <summary>
|
|
|
|
|
/// position of the left/right splitter
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double SplitterPosition; |
|
|
|
|
public double TopPaneSplitterPosition, BottomPaneSplitterPosition; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DockLayoutSettings DockLayout { get; private set; } |
|
|
|
|
|
|
|
|
|
public void Save() |
|
|
|
|
{ |
|
|
|
|
XElement doc = new XElement("SessionSettings"); |
|
|
|
@ -102,12 +107,18 @@ namespace ICSharpCode.ILSpy
@@ -102,12 +107,18 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
doc.Add(new XElement("TopPaneSplitterPosition", ToString(this.TopPaneSplitterPosition))); |
|
|
|
|
doc.Add(new XElement("BottomPaneSplitterPosition", ToString(this.BottomPaneSplitterPosition))); |
|
|
|
|
doc.Add(new XElement("SelectedSearchMode", ToString(this.SelectedSearchMode))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dockLayoutElement = new XElement("DockLayout"); |
|
|
|
|
if (DockLayout.Valid) { |
|
|
|
|
dockLayoutElement.Add(DockLayout.SaveAsXml()); |
|
|
|
|
} |
|
|
|
|
doc.Add(dockLayoutElement); |
|
|
|
|
|
|
|
|
|
ILSpySettings.SaveSettings(doc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Regex regex = new Regex("\\\\x(?<num>[0-9A-f]{4})"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static string Escape(string p) |
|
|
|
|
{ |
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
@ -119,12 +130,12 @@ namespace ICSharpCode.ILSpy
@@ -119,12 +130,12 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
} |
|
|
|
|
return sb.ToString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static string Unescape(string p) |
|
|
|
|
{ |
|
|
|
|
return regex.Replace(p, m => ((char)int.Parse(m.Groups["num"].Value, NumberStyles.HexNumber)).ToString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static T FromString<T>(string s, T defaultValue) |
|
|
|
|
{ |
|
|
|
|
if (s == null) |
|
|
|
@ -136,7 +147,7 @@ namespace ICSharpCode.ILSpy
@@ -136,7 +147,7 @@ namespace ICSharpCode.ILSpy
|
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static string ToString<T>(T obj) |
|
|
|
|
{ |
|
|
|
|
TypeConverter c = TypeDescriptor.GetConverter(typeof(T)); |
|
|
|
|