Browse Source

Merge branch 'master' into feature/ReferenceAssemblyOverly

pull/3013/head
workgroupengineering 11 months ago committed by GitHub
parent
commit
5798460318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      Directory.Packages.props
  2. 4
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
  3. 1
      ICSharpCode.Decompiler/Metadata/MetadataFile.cs
  4. 1
      ICSharpCode.Decompiler/Metadata/PEFile.cs
  5. 1
      ICSharpCode.Decompiler/Metadata/WebCilFile.cs
  6. 4
      ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs
  7. 4
      ICSharpCode.ILSpyX/LoadedAssembly.cs
  8. 5
      ILSpy/App.xaml
  9. 4
      ILSpy/Controls/ZoomScrollViewer.xaml
  10. 3
      ILSpy/Metadata/Helpers.cs
  11. 2
      ILSpy/Options/DecompilerSettingsPanel.xaml
  12. 2
      ILSpy/Options/DisplaySettingsPanel.xaml
  13. 4
      ILSpy/Search/SearchPane.xaml
  14. 6
      ILSpy/TextView/DecompilerTextView.xaml
  15. 9
      ILSpy/TreeNodes/AssemblyTreeNode.cs

2
Directory.Packages.props

@ -45,7 +45,7 @@
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" /> <PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" />
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" /> <PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" /> <PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="TomsToolbox.Wpf.Styles" Version="2.16.0" /> <PackageVersion Include="TomsToolbox.Wpf.Styles" Version="2.17.3" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> <PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -2694,8 +2694,12 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
propertyDeclaration.Initializer.AcceptVisitor(this); propertyDeclaration.Initializer.AcceptVisitor(this);
Semicolon(); Semicolon();
} }
else
{
// The call to Semicolon() above prints a newline too
NewLine(); NewLine();
} }
}
else else
{ {
Space(); Space();

1
ICSharpCode.Decompiler/Metadata/MetadataFile.cs

@ -61,6 +61,7 @@ namespace ICSharpCode.Decompiler.Metadata
public virtual int MetadataOffset { get; } public virtual int MetadataOffset { get; }
public virtual bool IsEmbedded { get; } public virtual bool IsEmbedded { get; }
public virtual bool IsMetadataOnly { get; } = true;
public bool IsAssembly => Metadata.IsAssembly; public bool IsAssembly => Metadata.IsAssembly;

1
ICSharpCode.Decompiler/Metadata/PEFile.cs

@ -53,6 +53,7 @@ namespace ICSharpCode.Decompiler.Metadata
public override bool IsEmbedded => false; public override bool IsEmbedded => false;
public override int MetadataOffset => Reader.PEHeaders.MetadataStartOffset; public override int MetadataOffset => Reader.PEHeaders.MetadataStartOffset;
public override bool IsMetadataOnly => false;
public void Dispose() public void Dispose()
{ {

1
ICSharpCode.Decompiler/Metadata/WebCilFile.cs

@ -183,6 +183,7 @@ namespace ICSharpCode.Decompiler.Metadata
} }
public override int MetadataOffset { get; } public override int MetadataOffset { get; }
public override bool IsMetadataOnly => false;
private static int GetContainingSectionIndex(IEnumerable<SectionHeader> sections, int rva) private static int GetContainingSectionIndex(IEnumerable<SectionHeader> sections, int rva)
{ {

4
ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

@ -72,7 +72,7 @@ namespace ICSharpCode.ILSpyX.Analyzers
{ {
return assemblyListSnapshot.GetAllAssembliesAsync().GetAwaiter().GetResult() return assemblyListSnapshot.GetAllAssembliesAsync().GetAwaiter().GetResult()
.Select(asm => asm.GetMetadataFileOrNull()) .Select(asm => asm.GetMetadataFileOrNull())
.Where(x => x != null)!; .Where(x => x != null && !x.IsMetadataOnly)!;
} }
public DecompilerTypeSystem ConstructTypeSystem(MetadataFile module) public DecompilerTypeSystem ConstructTypeSystem(MetadataFile module)
@ -207,7 +207,7 @@ namespace ICSharpCode.ILSpyX.Analyzers
if (friendAssemblies.Contains(assembly.ShortName)) if (friendAssemblies.Contains(assembly.ShortName))
{ {
var module = assembly.GetMetadataFileOrNull(); var module = assembly.GetMetadataFileOrNull();
if (module == null) if (module == null || module.IsMetadataOnly)
continue; continue;
if (ModuleReferencesScopeType(module.Metadata, typeScope.Name, typeScope.Namespace)) if (ModuleReferencesScopeType(module.Metadata, typeScope.Name, typeScope.Namespace))
yield return module; yield return module;

4
ICSharpCode.ILSpyX/LoadedAssembly.cs

@ -211,7 +211,7 @@ namespace ICSharpCode.ILSpyX
{ {
return LazyInitializer.EnsureInitialized(ref this.typeSystem, () => { return LazyInitializer.EnsureInitialized(ref this.typeSystem, () => {
var module = GetMetadataFileOrNull(); var module = GetMetadataFileOrNull();
if (module == null) if (module == null || module.IsMetadataOnly)
return null!; return null!;
return new SimpleCompilation( return new SimpleCompilation(
module.WithOptions(TypeSystemOptions.Default | TypeSystemOptions.Uncached | TypeSystemOptions.KeepModifiers), module.WithOptions(TypeSystemOptions.Default | TypeSystemOptions.Uncached | TypeSystemOptions.KeepModifiers),
@ -230,7 +230,7 @@ namespace ICSharpCode.ILSpyX
if (typeSystemWithOptions != null && options == currentTypeSystemOptions) if (typeSystemWithOptions != null && options == currentTypeSystemOptions)
return typeSystemWithOptions; return typeSystemWithOptions;
var module = GetMetadataFileOrNull(); var module = GetMetadataFileOrNull();
if (module == null) if (module == null || module.IsMetadataOnly)
return null; return null;
currentTypeSystemOptions = options; currentTypeSystemOptions = options;
return typeSystemWithOptions = new SimpleCompilation( return typeSystemWithOptions = new SimpleCompilation(

5
ILSpy/App.xaml

@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="urn:TomsToolbox.Wpf.Styles" xmlns:styles="urn:TomsToolbox.Wpf.Styles"
xmlns:toms="urn:TomsToolbox" xmlns:toms="urn:TomsToolbox"
xmlns:ilSpy="clr-namespace:ICSharpCode.ILSpy"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes" xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
@ -25,5 +24,9 @@
<Setter Property="Padding" Value="9,1,9,1" /> <Setter Property="Padding" Value="9,1,9,1" />
</Style> </Style>
<Style TargetType="ScrollViewer">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithAnimation" />
</Style>
</Application.Resources> </Application.Resources>
</Application> </Application>

4
ILSpy/Controls/ZoomScrollViewer.xaml

@ -1,8 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.ILSpy.Controls"> xmlns:Controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:toms="urn:TomsToolbox">
<Style TargetType="{x:Type Controls:ZoomScrollViewer}"> <Style TargetType="{x:Type Controls:ZoomScrollViewer}">
<Setter Property="toms:AdvancedScrollWheelBehavior.Attach" Value="WithAnimation" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}"> <ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}">

3
ILSpy/Metadata/Helpers.cs

@ -42,6 +42,8 @@ using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes; using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpy.ViewModels; using ICSharpCode.ILSpy.ViewModels;
using TomsToolbox.Wpf.Interactivity;
namespace ICSharpCode.ILSpy.Metadata namespace ICSharpCode.ILSpy.Metadata
{ {
static class Helpers static class Helpers
@ -69,6 +71,7 @@ namespace ICSharpCode.ILSpy.Metadata
ContextMenuProvider.Add(view); ContextMenuProvider.Add(view);
DataGridFilter.SetIsAutoFilterEnabled(view, true); DataGridFilter.SetIsAutoFilterEnabled(view, true);
DataGridFilter.SetContentFilterFactory(view, new RegexContentFilterFactory()); DataGridFilter.SetContentFilterFactory(view, new RegexContentFilterFactory());
AdvancedScrollWheelBehavior.SetAttach(view, AdvancedScrollWheelMode.WithoutAnimation);
} }
DataGridFilter.GetFilter(view).Clear(); DataGridFilter.GetFilter(view).Clear();
view.RowDetailsTemplateSelector = null; view.RowDetailsTemplateSelector = null;

2
ILSpy/Options/DecompilerSettingsPanel.xaml

@ -20,7 +20,7 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Margin="3" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="{x:Static properties:Resources.DecompilerSettingsPanelLongText}" /> <TextBlock Margin="3" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="{x:Static properties:Resources.DecompilerSettingsPanelLongText}" />
<ListBox Grid.Row="1" ItemsSource="{Binding Source={StaticResource SettingsCollection}}" toms:SmoothScrollingBehavior.Register="True"> <ListBox Grid.Row="1" ItemsSource="{Binding Source={StaticResource SettingsCollection}}">
<ListBox.ItemContainerStyle> <ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem"> <Style TargetType="ListBoxItem">
<Setter Property="IsTabStop" Value="False"/> <Setter Property="IsTabStop" Value="False"/>

2
ILSpy/Options/DisplaySettingsPanel.xaml

@ -12,7 +12,7 @@
<UserControl.Resources> <UserControl.Resources>
<local:FontSizeConverter x:Key="fontSizeConv" /> <local:FontSizeConverter x:Key="fontSizeConv" />
</UserControl.Resources> </UserControl.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" toms:SmoothScrollingBehavior.Register="True"> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<DockPanel> <DockPanel>
<Label DockPanel.Dock="Left" Content="{x:Static properties:Resources.DisplaySettingsPanel_Theme}" /> <Label DockPanel.Dock="Left" Content="{x:Static properties:Resources.DisplaySettingsPanel_Theme}" />

4
ILSpy/Search/SearchPane.xaml

@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties" xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="self" mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="self" mc:Ignorable="d"
xmlns:toms="urn:TomsToolbox"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -42,7 +43,8 @@
<ListView Grid.Row="2" BorderThickness="0,1,0,0" HorizontalContentAlignment="Stretch" KeyDown="ListBox_KeyDown" <ListView Grid.Row="2" BorderThickness="0,1,0,0" HorizontalContentAlignment="Stretch" KeyDown="ListBox_KeyDown"
MouseDoubleClick="ListBox_MouseDoubleClick" Name="listBox" SelectionMode="Single" controls:SortableGridViewColumn.SortMode="Automatic" MouseDoubleClick="ListBox_MouseDoubleClick" Name="listBox" SelectionMode="Single" controls:SortableGridViewColumn.SortMode="Automatic"
controls:GridViewColumnAutoSize.AutoWidth="40%;40%;20%" BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" controls:GridViewColumnAutoSize.AutoWidth="40%;40%;20%" BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"
ItemsSource="{Binding Results, ElementName=self}"> ItemsSource="{Binding Results, ElementName=self}"
toms:AdvancedScrollWheelBehavior.Attach="WithoutAnimation">
<ListView.View> <ListView.View>
<GridView AllowsColumnReorder="False"> <GridView AllowsColumnReorder="False">
<controls:SortableGridViewColumn Header="{x:Static properties:Resources.Name}" SortBy="Name"> <controls:SortableGridViewColumn Header="{x:Static properties:Resources.Name}" SortBy="Name">

6
ILSpy/TextView/DecompilerTextView.xaml

@ -1,4 +1,4 @@
<UserControl x:Class="ICSharpCode.ILSpy.TextView.DecompilerTextView" x:ClassModifier="public" x:Name="self" <UserControl x:Class="ICSharpCode.ILSpy.TextView.DecompilerTextView" x:Name="self"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties" xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties"
@ -10,7 +10,6 @@
xmlns:toms="urn:TomsToolbox" xmlns:toms="urn:TomsToolbox"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"> xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes">
<UserControl.Resources> <UserControl.Resources>
<BooleanToVisibilityConverter x:Key="boolToVisibility" />
<SolidColorBrush x:Key="waitAdornerBackgoundBrush" Color="{DynamicResource {x:Static SystemColors.WindowColorKey}}" Opacity=".75" /> <SolidColorBrush x:Key="waitAdornerBackgoundBrush" Color="{DynamicResource {x:Static SystemColors.WindowColorKey}}" Opacity=".75" />
<Style TargetType="{x:Type editing:TextArea}"> <Style TargetType="{x:Type editing:TextArea}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" />
@ -82,8 +81,7 @@
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
TextOptions.TextFormattingMode="{Binding CurrentZoom, ElementName=PART_ScrollViewer, Converter={x:Static local:ZoomLevelToTextFormattingModeConverter.Instance}}" TextOptions.TextFormattingMode="{Binding CurrentZoom, ElementName=PART_ScrollViewer, Converter={x:Static local:ZoomLevelToTextFormattingModeConverter.Instance}}"/>
toms:SmoothScrollingBehavior.Register="true"/>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="WordWrap" <Trigger Property="WordWrap"
Value="True"> Value="True">

9
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -467,7 +467,16 @@ namespace ICSharpCode.ILSpy.TreeNodes
var loadResult = LoadedAssembly.GetLoadResultAsync().GetAwaiter().GetResult(); var loadResult = LoadedAssembly.GetLoadResultAsync().GetAwaiter().GetResult();
if (loadResult.MetadataFile != null) if (loadResult.MetadataFile != null)
{ {
switch (loadResult.MetadataFile.Kind)
{
case MetadataFile.MetadataFileKind.ProgramDebugDatabase:
case MetadataFile.MetadataFileKind.Metadata:
output.WriteLine("// " + LoadedAssembly.FileName);
break;
default:
language.DecompileAssembly(LoadedAssembly, output, options); language.DecompileAssembly(LoadedAssembly, output, options);
break;
}
} }
else if (loadResult.Package != null) else if (loadResult.Package != null)
{ {

Loading…
Cancel
Save