From d3d8892a3b950be402e4a3fd19530671a8f9b28c Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 4 Feb 2011 13:00:25 +0100 Subject: [PATCH] Add references folder. --- ILSpy.sln | 10 +++++ ILSpy/AssemblyReferenceTreeNode.cs | 34 ++++++++++++++++ ILSpy/AssemblyTreeNode.cs | 2 +- ILSpy/ILSpy.csproj | 11 ++++++ ILSpy/Images/Images.cs | 3 ++ ILSpy/Images/ReferenceFolder.Closed.png | Bin 0 -> 1148 bytes ILSpy/Images/ReferenceFolder.Open.png | Bin 0 -> 1148 bytes ILSpy/MainWindow.xaml | 50 +++++++++++++++++++++--- ILSpy/MainWindow.xaml.cs | 1 - ILSpy/ModuleReferenceTreeNode.cs | 28 +++++++++++++ ILSpy/ReferenceFolderTreeNode.cs | 43 ++++++++++++++++++++ 11 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 ILSpy/AssemblyReferenceTreeNode.cs create mode 100644 ILSpy/Images/ReferenceFolder.Closed.png create mode 100644 ILSpy/Images/ReferenceFolder.Open.png create mode 100644 ILSpy/ModuleReferenceTreeNode.cs create mode 100644 ILSpy/ReferenceFolderTreeNode.cs diff --git a/ILSpy.sln b/ILSpy.sln index 5ade10b79..cdbe56988 100644 --- a/ILSpy.sln +++ b/ILSpy.sln @@ -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 {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 diff --git a/ILSpy/AssemblyReferenceTreeNode.cs b/ILSpy/AssemblyReferenceTreeNode.cs new file mode 100644 index 000000000..7f9f45558 --- /dev/null +++ b/ILSpy/AssemblyReferenceTreeNode.cs @@ -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 +{ + /// + /// Node within assembly reference list. + /// + 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 + } +} diff --git a/ILSpy/AssemblyTreeNode.cs b/ILSpy/AssemblyTreeNode.cs index 24f8d3a91..b1ad4956f 100644 --- a/ILSpy/AssemblyTreeNode.cs +++ b/ILSpy/AssemblyTreeNode.cs @@ -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(); } diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index d3abfec2a..724a7b9b0 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -65,10 +65,12 @@ App.xaml + + @@ -77,6 +79,7 @@ Code MainWindow.xaml + @@ -126,10 +129,18 @@ {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil + + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} + ICSharpCode.AvalonEdit + {DDE2A481-8271-4EAC-A330-8FA6A38D13D1} ICSharpCode.TreeView + + + + \ No newline at end of file diff --git a/ILSpy/Images/Images.cs b/ILSpy/Images/Images.cs index 54bb6ac84..1f8426e7c 100644 --- a/ILSpy/Images/Images.cs +++ b/ILSpy/Images/Images.cs @@ -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"); diff --git a/ILSpy/Images/ReferenceFolder.Closed.png b/ILSpy/Images/ReferenceFolder.Closed.png new file mode 100644 index 0000000000000000000000000000000000000000..1a016792f1b5c07c4be9e9483bf5092a76d61dbb GIT binary patch literal 1148 zcmd5(ziU%b7(LHE8yhV|3R>$RaZp^uK?etmjR`hGi;4~f!3gT2NWeJi;8ev~K`kga zs=>h_WDp#*h=YoiK#2`%@Tt7l{CK}#lIK0QCTRKx=m+0D_kMim-0z-y{mAs;;pkWt zz;Jppc}!r8xo%Lb+nV8N0YllznM=U>5vGDW_eMoAl1opeA|E!4Y+Sn|TbS7ds9V#? ziQ}VNl$g34h>m|8inu>sEEYfY&yh-{wu{yXwW4qnP>-S4A9S@e{z_x7s&}%rfH!cNArIPIBqOzIs?PnA3N?&nsUmOpg zzQl!7Qy3Un5wsm2-*pSO9z4eQ?#&Q>Ng?uj0t<^(yqJH3w;vZVG`I$S;K8?AFzPl; z%f%PXz~`z4Z)Z$SOAmSi9DmQQG2Fgi#@*SAxH`m%-R^9!ie8)%poY}vzct{9A0zDYoqo)SaA0WB)FO=T()ZPT~ z5A;+)0v?2oAc81u?saH0(&pi z^X*W6QPckQ$)_8lmo{L~kDnn`G{4199rNy$9q_#$nV~;KA{>u>NQ7P+hoZYw9shY4 z%KxZPD7d>h9LIU5YWKVKC*O)JE0v1ucDsyryDeL-mdxk#QZ*kvA?y@{l#&900GBtL z4FT)*n!@2Q<#IW9wOY|*U@e(UA~_F%0$>;hlOZq|47MV=QO~7PNxwb_ESF32cswjn zE|+;hCxJK;Xd}}!DU-=aomSul4MGU2*X!IEi9}fNu@$ze#nA7%F3n~$;w>P7*XyNT zuSb?;(PFV+XaNv(Z9bnlip3&Dqfzb= zTD{Zhkl*j;MhI!5CQqkRCS#lGnkkV;@J)E&GMP+R&9-gQji@0BZUh((htzB~saC6P z-9h3lpuy+!Q8t@pAv};mpR}G~hNP)f>ft}YVzpZ3=s3vnc+Adl1n> + - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index 946bd4682..1045fe077 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -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 }; diff --git a/ILSpy/ModuleReferenceTreeNode.cs b/ILSpy/ModuleReferenceTreeNode.cs new file mode 100644 index 000000000..3cabd7903 --- /dev/null +++ b/ILSpy/ModuleReferenceTreeNode.cs @@ -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 +{ + /// + /// Module reference in ReferenceFolderTreeNode. + /// + 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; } + } + } +} diff --git a/ILSpy/ReferenceFolderTreeNode.cs b/ILSpy/ReferenceFolderTreeNode.cs new file mode 100644 index 000000000..b22683113 --- /dev/null +++ b/ILSpy/ReferenceFolderTreeNode.cs @@ -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 +{ + /// + /// References folder. + /// + 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)); + } + } +}