Browse Source

Show embedded resources.

pull/1/head
Daniel Grunwald 14 years ago
parent
commit
64ae19c542
  1. 5
      ILSpy/AssemblyTreeNode.cs
  2. 2
      ILSpy/BaseTypesTreeNode.cs
  3. 12
      ILSpy/ILSpy.csproj
  4. 5
      ILSpy/Images/Images.cs
  5. BIN
      ILSpy/Images/Redo.png
  6. BIN
      ILSpy/Images/Refresh.png
  7. BIN
      ILSpy/Images/Resource.png
  8. BIN
      ILSpy/Images/SubTypes.png
  9. BIN
      ILSpy/Images/SuperTypes.png
  10. BIN
      ILSpy/Images/Undo.png
  11. 72
      ILSpy/ResourceListTreeNode.cs

5
ILSpy/AssemblyTreeNode.cs

@ -128,7 +128,10 @@ namespace ICSharpCode.ILSpy @@ -128,7 +128,10 @@ namespace ICSharpCode.ILSpy
protected override void LoadChildren()
{
assemblyTask.Wait();
this.Children.Add(new ReferenceFolderTreeNode(assemblyTask.Result.MainModule, this));
ModuleDefinition mainModule = assemblyTask.Result.MainModule;
this.Children.Add(new ReferenceFolderTreeNode(mainModule, this));
if (mainModule.HasResources)
this.Children.Add(new ResourceListTreeNode(mainModule));
foreach (NamespaceTreeNode ns in namespaces.Values) {
ns.Children.Clear();
}

2
ILSpy/BaseTypesTreeNode.cs

@ -42,7 +42,7 @@ namespace ICSharpCode.ILSpy @@ -42,7 +42,7 @@ namespace ICSharpCode.ILSpy
}
public override object Icon {
get { return Images.Undo; }
get { return Images.SuperTypes; }
}
protected override void LoadChildren()

12
ILSpy/ILSpy.csproj

@ -105,6 +105,7 @@ @@ -105,6 +105,7 @@
<Compile Include="PropertyTreeNode.cs" />
<Compile Include="ReferenceFolderTreeNode.cs" />
<Compile Include="ReferenceElementGenerator.cs" />
<Compile Include="ResourceListTreeNode.cs" />
<Compile Include="SortableGridViewColumn.cs" />
<Compile Include="TreeTraversal.cs" />
<Compile Include="TypeTreeNode.cs" />
@ -172,10 +173,6 @@ @@ -172,10 +173,6 @@
<Resource Include="Images\ReferenceFolder.Closed.png" />
<Resource Include="Images\ReferenceFolder.Open.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Redo.png" />
<Resource Include="Images\Undo.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Event.png" />
<Resource Include="Images\ExtensionMethod.png" />
@ -195,5 +192,12 @@ @@ -195,5 +192,12 @@
<ItemGroup>
<Resource Include="Images\Library.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\SubTypes.png" />
<Resource Include="Images\SuperTypes.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Resource.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

5
ILSpy/Images/Images.cs

@ -22,9 +22,10 @@ namespace ICSharpCode.ILSpy @@ -22,9 +22,10 @@ namespace ICSharpCode.ILSpy
public static readonly BitmapImage ReferenceFolderOpen = LoadBitmap("ReferenceFolder.Open");
public static readonly BitmapImage ReferenceFolderClosed = LoadBitmap("ReferenceFolder.Closed");
public static readonly BitmapImage Redo = LoadBitmap("Redo");
public static readonly BitmapImage Undo = LoadBitmap("Undo");
public static readonly BitmapImage SubTypes = LoadBitmap("SubTypes");
public static readonly BitmapImage SuperTypes = LoadBitmap("SuperTypes");
public static readonly BitmapImage Resource = LoadBitmap("Resource");
public static readonly BitmapImage Class = LoadBitmap("Class");
public static readonly BitmapImage Delegate = LoadBitmap("Delegate");

BIN
ILSpy/Images/Redo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

BIN
ILSpy/Images/Refresh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
ILSpy/Images/Resource.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

BIN
ILSpy/Images/SubTypes.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

BIN
ILSpy/Images/SuperTypes.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

BIN
ILSpy/Images/Undo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

72
ILSpy/ResourceListTreeNode.cs

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
using Mono.Cecil;
namespace ICSharpCode.ILSpy
{
/// <summary>
/// Description of ResourcesTreeNode.
/// </summary>
class ResourceListTreeNode : ILSpyTreeNode<ResourceTreeNode>
{
readonly ModuleDefinition module;
public ResourceListTreeNode(ModuleDefinition module)
{
this.LazyLoading = true;
this.module = module;
}
public override object Text {
get { return "Resources"; }
}
public override object Icon {
get { return Images.Resource; }
}
protected override void LoadChildren()
{
foreach (Resource r in module.Resources)
this.Children.Add(new ResourceTreeNode(r));
}
public override FilterResult Filter(FilterSettings settings)
{
if (string.IsNullOrEmpty(settings.SearchTerm))
return FilterResult.Match;
else
return FilterResult.Recurse;
}
}
class ResourceTreeNode : ILSpyTreeNode
{
Resource r;
public ResourceTreeNode(Resource r)
{
this.r = r;
}
public override object Text {
get { return r.Name; }
}
public override object Icon {
get { return Images.Resource; }
}
public override FilterResult Filter(FilterSettings settings)
{
if (!settings.ShowInternalApi && (r.Attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Private)
return FilterResult.Hidden;
if (settings.SearchTermMatches(r.Name))
return FilterResult.Match;
else
return FilterResult.Hidden;
}
}
}
Loading…
Cancel
Save