Browse Source

Add Show GC Info checkbox

pull/3076/head
unknown 2 years ago
parent
commit
c39a1f7fcc
  1. 11
      ILSpy.ReadyToRun/Properties/Resources.Designer.cs
  2. 3
      ILSpy.ReadyToRun/Properties/Resources.resx
  3. 3
      ILSpy.ReadyToRun/Properties/Resources.zh-Hans.resx
  4. 2
      ILSpy.ReadyToRun/ReadyToRunDisassembler.cs
  5. 3
      ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml
  6. 15
      ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs
  7. 22
      ILSpy.ReadyToRun/ReadyToRunOptions.cs

11
ILSpy.ReadyToRun/Properties/Resources.Designer.cs generated

@ -95,5 +95,14 @@ namespace ILSpy.ReadyToRun.Properties {
return ResourceManager.GetString("ShowUnwindInfo", resourceCulture); return ResourceManager.GetString("ShowUnwindInfo", resourceCulture);
} }
} }
}
/// <summary>
/// Looks up a localized string similar to Show GC Info.
/// </summary>
public static string ShowGCInfo {
get {
return ResourceManager.GetString("ShowGCInfo", resourceCulture);
}
}
}
} }

3
ILSpy.ReadyToRun/Properties/Resources.resx

@ -129,4 +129,7 @@
<data name="ShowUnwindInfo" xml:space="preserve"> <data name="ShowUnwindInfo" xml:space="preserve">
<value>Show Unwind Info</value> <value>Show Unwind Info</value>
</data> </data>
<data name="ShowGCInfo" xml:space="preserve">
<value>Show GC Info</value>
</data>
</root> </root>

3
ILSpy.ReadyToRun/Properties/Resources.zh-Hans.resx

@ -129,4 +129,7 @@
<data name="ShowUnwindInfo" xml:space="preserve"> <data name="ShowUnwindInfo" xml:space="preserve">
<value>显示展开信息</value> <value>显示展开信息</value>
</data> </data>
<data name="ShowGCInfo" xml:space="preserve">
<value>?</value>
</data>
</root> </root>

2
ILSpy.ReadyToRun/ReadyToRunDisassembler.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
ReadyToRunMethod readyToRunMethod = runtimeFunction.Method; ReadyToRunMethod readyToRunMethod = runtimeFunction.Method;
WriteCommentLine(readyToRunMethod.SignatureString); WriteCommentLine(readyToRunMethod.SignatureString);
if (readyToRunMethod.GcInfo != null) if (ReadyToRunOptions.GetIsShowGCInfo(null) && readyToRunMethod.GcInfo != null)
{ {
string[] lines = readyToRunMethod.GcInfo.ToString().Split(Environment.NewLine); string[] lines = readyToRunMethod.GcInfo.ToString().Split(Environment.NewLine);
WriteCommentLine("GC info:"); WriteCommentLine("GC info:");

3
ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml

@ -11,6 +11,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Margin="3" Text="{x:Static properties:Resources.DisassemblyFormat}" /> <TextBlock Margin="3" Text="{x:Static properties:Resources.DisassemblyFormat}" />
<ComboBox Grid.Column="1" Margin="3" ItemsSource="{Binding DisassemblyFormats}" SelectedItem="{Binding DisassemblyFormat}" /> <ComboBox Grid.Column="1" Margin="3" ItemsSource="{Binding DisassemblyFormats}" SelectedItem="{Binding DisassemblyFormat}" />
@ -18,5 +19,7 @@
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3" IsChecked="{Binding IsShowUnwindInfo}" /> <CheckBox Grid.Row="1" Grid.Column="1" Margin="3" IsChecked="{Binding IsShowUnwindInfo}" />
<TextBlock Grid.Row="2" Margin="3" Text="{x:Static properties:Resources.ShowDebugInfo}"/> <TextBlock Grid.Row="2" Margin="3" Text="{x:Static properties:Resources.ShowDebugInfo}"/>
<CheckBox Grid.Row="2" Grid.Column="1" Margin="3" IsChecked="{Binding IsShowDebugInfo}" /> <CheckBox Grid.Row="2" Grid.Column="1" Margin="3" IsChecked="{Binding IsShowDebugInfo}" />
<TextBlock Grid.Row="3" Margin="3" Text="{x:Static properties:Resources.ShowGCInfo}"/>
<CheckBox Grid.Row="3" Grid.Column="1" Margin="3" IsChecked="{Binding IsShowGCInfo}" />
</Grid> </Grid>
</UserControl> </UserControl>

15
ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs

@ -39,6 +39,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
s.DisassemblyFormat = ReadyToRunOptions.GetDisassemblyFormat(settings); s.DisassemblyFormat = ReadyToRunOptions.GetDisassemblyFormat(settings);
s.IsShowUnwindInfo = ReadyToRunOptions.GetIsShowUnwindInfo(settings); s.IsShowUnwindInfo = ReadyToRunOptions.GetIsShowUnwindInfo(settings);
s.IsShowDebugInfo = ReadyToRunOptions.GetIsShowDebugInfo(settings); s.IsShowDebugInfo = ReadyToRunOptions.GetIsShowDebugInfo(settings);
s.IsShowGCInfo = ReadyToRunOptions.GetIsShowGCInfo(settings);
this.DataContext = s; this.DataContext = s;
} }
@ -51,7 +52,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
public void Save(XElement root) public void Save(XElement root)
{ {
Options s = (Options)this.DataContext; Options s = (Options)this.DataContext;
ReadyToRunOptions.SetDisassemblyOptions(root, s.DisassemblyFormat, s.IsShowUnwindInfo, s.IsShowDebugInfo); ReadyToRunOptions.SetDisassemblyOptions(root, s.DisassemblyFormat, s.IsShowUnwindInfo, s.IsShowDebugInfo, s.IsShowGCInfo);
} }
} }
@ -86,6 +87,18 @@ namespace ICSharpCode.ILSpy.ReadyToRun
} }
} }
private bool isShowGCInfo;
public bool IsShowGCInfo {
get {
return isShowGCInfo;
}
set {
isShowGCInfo = value;
OnPropertyChanged(nameof(IsShowGCInfo));
}
}
private string disassemblyFormat; private string disassemblyFormat;
public string DisassemblyFormat { public string DisassemblyFormat {

22
ILSpy.ReadyToRun/ReadyToRunOptions.cs

@ -87,12 +87,32 @@ namespace ICSharpCode.ILSpy.ReadyToRun
} }
} }
public static void SetDisassemblyOptions(XElement root, string disassemblyFormat, bool isShowUnwindInfo, bool isShowDebugInfo) public static bool GetIsShowGCInfo(ILSpySettings settings)
{
if (settings == null)
{
settings = ILSpySettings.Load();
}
XElement e = settings[ns + "ReadyToRunOptions"];
XAttribute a = e.Attribute("IsShowGCInfo");
if (a == null)
{
return false;
}
else
{
return (bool)a;
}
}
public static void SetDisassemblyOptions(XElement root, string disassemblyFormat, bool isShowUnwindInfo, bool isShowDebugInfo, bool isShowGCInfo)
{ {
XElement section = new XElement(ns + "ReadyToRunOptions"); XElement section = new XElement(ns + "ReadyToRunOptions");
section.SetAttributeValue("DisassemblyFormat", disassemblyFormat); section.SetAttributeValue("DisassemblyFormat", disassemblyFormat);
section.SetAttributeValue("IsShowUnwindInfo", isShowUnwindInfo); section.SetAttributeValue("IsShowUnwindInfo", isShowUnwindInfo);
section.SetAttributeValue("IsShowDebugInfo", isShowDebugInfo); section.SetAttributeValue("IsShowDebugInfo", isShowDebugInfo);
section.SetAttributeValue("IsShowGCInfo", isShowGCInfo);
XElement existingElement = root.Element(ns + "ReadyToRunOptions"); XElement existingElement = root.Element(ns + "ReadyToRunOptions");
if (existingElement != null) if (existingElement != null)
{ {

Loading…
Cancel
Save