Browse Source

Add references folder.

pull/1/head
Daniel Grunwald 14 years ago
parent
commit
d3d8892a3b
  1. 10
      ILSpy.sln
  2. 34
      ILSpy/AssemblyReferenceTreeNode.cs
  3. 2
      ILSpy/AssemblyTreeNode.cs
  4. 11
      ILSpy/ILSpy.csproj
  5. 3
      ILSpy/Images/Images.cs
  6. BIN
      ILSpy/Images/ReferenceFolder.Closed.png
  7. BIN
      ILSpy/Images/ReferenceFolder.Open.png
  8. 50
      ILSpy/MainWindow.xaml
  9. 1
      ILSpy/MainWindow.xaml.cs
  10. 28
      ILSpy/ModuleReferenceTreeNode.cs
  11. 43
      ILSpy/ReferenceFolderTreeNode.cs

10
ILSpy.sln

@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "Sha @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "Sha
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "Mono.Cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", "AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj", "{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@ -36,5 +38,13 @@ Global @@ -36,5 +38,13 @@ Global
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = net_4_0_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_2_0_Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.Build.0 = Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.ActiveCfg = Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.Build.0 = Release|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.ActiveCfg = Release|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

34
ILSpy/AssemblyReferenceTreeNode.cs

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
// 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 ICSharpCode.TreeView;
using Mono.Cecil;
namespace ICSharpCode.ILSpy
{
/// <summary>
/// Node within assembly reference list.
/// </summary>
public class AssemblyReferenceTreeNode : SharpTreeNode
{
readonly AssemblyNameReference r;
public AssemblyReferenceTreeNode(AssemblyNameReference r)
{
if (r == null)
throw new ArgumentNullException("r");
this.r = r;
}
public override object Text {
get { return r.Name; }
}
public override object Icon {
get { return Images.Assembly; }
}
// TODO: allow drilling down into references used by this reference
}
}

2
ILSpy/AssemblyTreeNode.cs

@ -54,7 +54,7 @@ namespace ICSharpCode.ILSpy @@ -54,7 +54,7 @@ namespace ICSharpCode.ILSpy
protected override void LoadChildren()
{
assemblyTask.Wait();
this.Children.Add(new ReferenceFolderTreeNode(assemblyTask.Result.MainModule));
foreach (NamespaceTreeNode ns in namespaces.Values) {
ns.Children.Clear();
}

11
ILSpy/ILSpy.csproj

@ -65,10 +65,12 @@ @@ -65,10 +65,12 @@
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="AssemblyListTreeNode.cs" />
<Compile Include="AssemblyReferenceTreeNode.cs" />
<Compile Include="AssemblyTreeNode.cs" />
<Compile Include="FieldTreeNode.cs" />
<Compile Include="Images\Images.cs" />
<Compile Include="MethodTreeNode.cs" />
<Compile Include="ModuleReferenceTreeNode.cs" />
<Compile Include="Mono.Cecil.Rocks\MethodBodyRocks.cs" />
<Compile Include="NamespaceTreeNode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -77,6 +79,7 @@ @@ -77,6 +79,7 @@
<SubType>Code</SubType>
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ReferenceFolderTreeNode.cs" />
<Compile Include="TreeTraversal.cs" />
<Compile Include="TypeTreeNode.cs" />
</ItemGroup>
@ -126,10 +129,18 @@ @@ -126,10 +129,18 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
<ProjectReference Include="..\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
<Name>ICSharpCode.AvalonEdit</Name>
</ProjectReference>
<ProjectReference Include="..\SharpTreeView\ICSharpCode.TreeView.csproj">
<Project>{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}</Project>
<Name>ICSharpCode.TreeView</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\ReferenceFolder.Closed.png" />
<Resource Include="Images\ReferenceFolder.Open.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

3
ILSpy/Images/Images.cs

@ -18,6 +18,9 @@ namespace ICSharpCode.ILSpy @@ -18,6 +18,9 @@ namespace ICSharpCode.ILSpy
public static readonly BitmapImage Assembly = LoadBitmap("Assembly");
public static readonly BitmapImage Namespace = LoadBitmap("NameSpace");
public static readonly BitmapImage ReferenceFolderOpen = LoadBitmap("ReferenceFolder.Open");
public static readonly BitmapImage ReferenceFolderClosed = LoadBitmap("ReferenceFolder.Closed");
public static readonly BitmapImage Class = LoadBitmap("Class");
public static readonly BitmapImage Delegate = LoadBitmap("Delegate");

BIN
ILSpy/Images/ReferenceFolder.Closed.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
ILSpy/Images/ReferenceFolder.Open.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

50
ILSpy/MainWindow.xaml

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
<Window x:Class="ICSharpCode.ILSpy.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview"
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="ICSharpCode.ILSpy.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview" xmlns:ae="http://icsharpcode.net/sharpdevelop/avalonedit"
Title="ILSpy"
Width="790"
Height="500"
@ -11,6 +10,45 @@ @@ -11,6 +10,45 @@
Hyperlink.RequestNavigate="Window_RequestNavigate"
TextOptions.TextFormattingMode="Display"
>
<tv:SharpTreeView Name="treeView" ShowRoot="False" AllowDropOrder="True" AllowDrop="True">
</tv:SharpTreeView>
<!-- Main grid separating left pane (treeView) from main pane (textEditor) -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
MinWidth="100"
Width="250" />
<ColumnDefinition
Width="3" />
<ColumnDefinition
MinWidth="100"
Width="0.514411764705882*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<!-- Tree View of assemblies and classes -->
<tv:SharpTreeView
Name="treeView"
ShowRoot="False"
AllowDropOrder="True"
AllowDrop="True" />
<GridSplitter
Grid.ZIndex="1"
Grid.Column="1"
Margin="-2,0"
BorderThickness="2,0"
BorderBrush="Transparent"
HorizontalAlignment="Stretch" />
<!-- DockPanel in right pane -->
<DockPanel
Grid.Column="2">
<ae:TextEditor
SyntaxHighlighting="C#"
FontFamily="Consolas"
FontSize="10pt"
IsReadOnly="True"
Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}"
Foreground="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}" />
</DockPanel>
</Grid>
</Window>

1
ILSpy/MainWindow.xaml.cs

@ -28,7 +28,6 @@ namespace ICSharpCode.ILSpy @@ -28,7 +28,6 @@ namespace ICSharpCode.ILSpy
typeof(System.Windows.FrameworkElement).Assembly,
typeof(ICSharpCode.TreeView.SharpTreeView).Assembly,
typeof(Mono.Cecil.AssemblyDefinition).Assembly,
typeof(ICSharpCode.NRefactory.SupportedLanguage).Assembly,
typeof(MainWindow).Assembly
};

28
ILSpy/ModuleReferenceTreeNode.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// 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 ICSharpCode.TreeView;
using Mono.Cecil;
namespace ICSharpCode.ILSpy
{
/// <summary>
/// Module reference in ReferenceFolderTreeNode.
/// </summary>
public class ModuleReferenceTreeNode : SharpTreeNode
{
ModuleReference r;
public ModuleReferenceTreeNode(ModuleReference r)
{
if (r == null)
throw new ArgumentNullException("r");
this.r = r;
}
public override object Text {
get { return r.Name; }
}
}
}

43
ILSpy/ReferenceFolderTreeNode.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
// 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 ICSharpCode.TreeView;
using Mono.Cecil;
namespace ICSharpCode.ILSpy
{
/// <summary>
/// References folder.
/// </summary>
public sealed class ReferenceFolderTreeNode : SharpTreeNode
{
ModuleDefinition module;
public ReferenceFolderTreeNode(ModuleDefinition module)
{
this.module = module;
this.LazyLoading = true;
}
public override object Text {
get { return "References"; }
}
public override object Icon {
get { return Images.ReferenceFolderClosed; }
}
public override object ExpandedIcon {
get { return Images.ReferenceFolderOpen; }
}
protected override void LoadChildren()
{
foreach (var r in module.AssemblyReferences)
this.Children.Add(new AssemblyReferenceTreeNode(r));
foreach (var r in module.ModuleReferences)
this.Children.Add(new ModuleReferenceTreeNode(r));
}
}
}
Loading…
Cancel
Save