Browse Source

Added specific icons for general xml-based resource nodes

pull/201/head
Ed Harvey 14 years ago
parent
commit
2ca0012251
  1. 9
      ILSpy/ILSpy.csproj
  2. 3
      ILSpy/Images/Images.cs
  3. BIN
      ILSpy/Images/ResourceXml.png
  4. BIN
      ILSpy/Images/ResourceXsd.png
  5. BIN
      ILSpy/Images/ResourceXslt.png
  6. 38
      ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs

9
ILSpy/ILSpy.csproj

@ -94,7 +94,7 @@
<Compile Include="AssemblyList.cs" /> <Compile Include="AssemblyList.cs" />
<Compile Include="AssemblyListManager.cs" /> <Compile Include="AssemblyListManager.cs" />
<Compile Include="BamlDecompiler.cs" /> <Compile Include="BamlDecompiler.cs" />
<Compile Include="BamlResourceEntryNode.cs" /> <Compile Include="TreeNodes\ResourceNodes\BamlResourceEntryNode.cs" />
<Compile Include="CommandLineArguments.cs" /> <Compile Include="CommandLineArguments.cs" />
<Compile Include="Commands.cs" /> <Compile Include="Commands.cs" />
<Compile Include="ConnectMethodDecompiler.cs" /> <Compile Include="ConnectMethodDecompiler.cs" />
@ -160,6 +160,7 @@
<Compile Include="TreeNodes\Analyzer\Helpers.cs" /> <Compile Include="TreeNodes\Analyzer\Helpers.cs" />
<Compile Include="TreeNodes\Analyzer\ScopedWhereUsedAnalyzer.cs" /> <Compile Include="TreeNodes\Analyzer\ScopedWhereUsedAnalyzer.cs" />
<Compile Include="TreeNodes\IMemberTreeNode.cs" /> <Compile Include="TreeNodes\IMemberTreeNode.cs" />
<Compile Include="TreeNodes\ResourceNodes\XmlResourceNode.cs" />
<Compile Include="TreeNodes\ResourceNodes\IResourceNodeFactory.cs" /> <Compile Include="TreeNodes\ResourceNodes\IResourceNodeFactory.cs" />
<Compile Include="TreeNodes\ResourceNodes\ResourcesFileTreeNode.cs" /> <Compile Include="TreeNodes\ResourceNodes\ResourcesFileTreeNode.cs" />
<Compile Include="TreeNodes\ResourceNodes\XamlResourceNode.cs" /> <Compile Include="TreeNodes\ResourceNodes\XamlResourceNode.cs" />
@ -315,6 +316,10 @@
<Name>ICSharpCode.TreeView</Name> <Name>ICSharpCode.TreeView</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Resource Include="Images\ResourceXml.png" />
<Resource Include="Images\ResourceXsd.png" />
<Resource Include="Images\ResourceXslt.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project> </Project>

3
ILSpy/Images/Images.cs

@ -59,6 +59,9 @@ namespace ICSharpCode.ILSpy
public static readonly BitmapImage Resource = LoadBitmap("Resource"); public static readonly BitmapImage Resource = LoadBitmap("Resource");
public static readonly BitmapImage ResourceImage = LoadBitmap("ResourceImage"); public static readonly BitmapImage ResourceImage = LoadBitmap("ResourceImage");
public static readonly BitmapImage ResourceResourcesFile = LoadBitmap("ResourceResourcesFile"); public static readonly BitmapImage ResourceResourcesFile = LoadBitmap("ResourceResourcesFile");
public static readonly BitmapImage ResourceXml = LoadBitmap("ResourceXml");
public static readonly BitmapImage ResourceXsd = LoadBitmap("ResourceXsd");
public static readonly BitmapImage ResourceXslt = LoadBitmap("ResourceXslt");
public static readonly BitmapImage Class = LoadBitmap("Class"); public static readonly BitmapImage Class = LoadBitmap("Class");
public static readonly BitmapImage Struct = LoadBitmap("Struct"); public static readonly BitmapImage Struct = LoadBitmap("Struct");

BIN
ILSpy/Images/ResourceXml.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

BIN
ILSpy/Images/ResourceXsd.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
ILSpy/Images/ResourceXslt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

38
ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs

@ -49,33 +49,51 @@ namespace ICSharpCode.ILSpy.Xaml
return null; return null;
} }
} }
sealed class XmlResourceEntryNode : ResourceEntryNode sealed class XmlResourceEntryNode : ResourceEntryNode
{ {
string xaml; string xml;
public XmlResourceEntryNode(string key, Stream data) : base(key, data) public XmlResourceEntryNode(string key, Stream data)
: base(key, data)
{
}
public override object Icon
{ {
get
{
string text = (string)Text;
if (text.EndsWith(".xml"))
return Images.ResourceXml;
else if (text.EndsWith(".xsd"))
return Images.ResourceXsd;
else if (text.EndsWith(".xslt"))
return Images.ResourceXslt;
else
return Images.Resource;
}
} }
internal override bool View(DecompilerTextView textView) internal override bool View(DecompilerTextView textView)
{ {
AvalonEditTextOutput output = new AvalonEditTextOutput(); AvalonEditTextOutput output = new AvalonEditTextOutput();
IHighlightingDefinition highlighting = null; IHighlightingDefinition highlighting = null;
textView.RunWithCancellation( textView.RunWithCancellation(
token => Task.Factory.StartNew( token => Task.Factory.StartNew(
() => { () => {
try { try {
// cache read XAML because stream will be closed after first read // cache read XAML because stream will be closed after first read
if (xaml == null) { if (xml == null) {
using (var reader = new StreamReader(Data)) { using (var reader = new StreamReader(Data)) {
xaml = reader.ReadToEnd(); xml = reader.ReadToEnd();
} }
} }
output.Write(xaml); output.Write(xml);
highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml"); highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
} catch (Exception ex) { }
catch (Exception ex) {
output.Write(ex.ToString()); output.Write(ex.ToString());
} }
return output; return output;

Loading…
Cancel
Save