Browse Source

Make all nodes display something in the output view.

pull/1/head
Daniel Grunwald 15 years ago
parent
commit
3d2459c6a4
  1. 2
      ILSpy/ILLanguage.cs
  2. 9
      ILSpy/Language.cs
  3. 10
      ILSpy/MainWindow.xaml
  4. 12
      ILSpy/TreeNodes/AssemblyListTreeNode.cs
  5. 6
      ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
  6. 15
      ILSpy/TreeNodes/BaseTypesTreeNode.cs
  7. 6
      ILSpy/TreeNodes/ILSpyTreeNode.cs
  8. 6
      ILSpy/TreeNodes/ModuleReferenceTreeNode.cs
  9. 4
      ILSpy/TreeNodes/NamespaceTreeNode.cs
  10. 9
      ILSpy/TreeNodes/ReferenceFolderTreeNode.cs
  11. 11
      ILSpy/TreeNodes/ResourceListTreeNode.cs

2
ILSpy/ILLanguage.cs

@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy @@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy
}
public override string Name {
get { return detectControlStructure ? "IL (structured)" : "IL"; }
get { return "IL"; }
}
public override string FileExtension {

9
ILSpy/Language.cs

@ -51,30 +51,38 @@ namespace ICSharpCode.ILSpy @@ -51,30 +51,38 @@ namespace ICSharpCode.ILSpy
public virtual void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, TypeToString(method.DeclaringType) + "." + method.Name);
}
public virtual void DecompileProperty(PropertyDefinition property, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, TypeToString(property.DeclaringType) + "." + property.Name);
}
public virtual void DecompileField(FieldDefinition field, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, TypeToString(field.DeclaringType) + "." + field.Name);
}
public virtual void DecompileEvent(EventDefinition ev, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, TypeToString(ev.DeclaringType) + "." + ev.Name);
}
public virtual void DecompileType(TypeDefinition type, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, TypeToString(type));
}
public virtual void DecompileNamespace(string nameSpace, IEnumerable<TypeDefinition> types, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, nameSpace);
}
public virtual void DecompileAssembly(AssemblyDefinition assembly, string fileName, ITextOutput output, DecompilationOptions options)
{
WriteCommentLine(output, fileName);
WriteCommentLine(output, assembly.Name.FullName);
}
public virtual void WriteCommentLine(ITextOutput output, string comment)
@ -107,7 +115,6 @@ namespace ICSharpCode.ILSpy @@ -107,7 +115,6 @@ namespace ICSharpCode.ILSpy
public static readonly ReadOnlyCollection<Language> AllLanguages = Array.AsReadOnly(
new Language[] {
new CSharpLanguage(),
new ILLanguage(false),
new ILLanguage(true)
});

10
ILSpy/MainWindow.xaml

@ -29,6 +29,11 @@ @@ -29,6 +29,11 @@
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Open from _GAC" Click="OpenFromGac_Click" />
<MenuItem Command="Refresh" Header="_Reload">
<MenuItem.Icon>
<Image Width="16" Height="16" Source="Images/Refresh.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="_Save Code" Click="saveCode_Click">
<MenuItem.Icon>
@ -39,11 +44,6 @@ @@ -39,11 +44,6 @@
<MenuItem Header="E_xit" Click="ExitClick" />
</MenuItem>
<MenuItem Header="_View">
<MenuItem Command="Refresh">
<MenuItem.Icon>
<Image Width="16" Height="16" Source="Images/Refresh.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Show _internal types and members" IsCheckable="True" IsChecked="{Binding FilterSettings.ShowInternalApi}">
<MenuItem.Icon>
<Image Width="16" Height="16" Source="Images/PrivateInternal.png" />

12
ILSpy/TreeNodes/AssemblyListTreeNode.cs

@ -20,6 +20,7 @@ using System; @@ -20,6 +20,7 @@ using System;
using System.Linq;
using System.Windows;
using ICSharpCode.Decompiler;
using ICSharpCode.TreeView;
namespace ICSharpCode.ILSpy.TreeNodes
@ -79,5 +80,16 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -79,5 +80,16 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
public Action<SharpTreeNode> Select = delegate {};
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, "List: " + assemblyList.ListName);
output.WriteLine();
foreach (AssemblyTreeNode asm in assemblyList.Assemblies) {
language.WriteCommentLine(output, new string('-', 60));
output.WriteLine();
asm.Decompile(language, output, options);
}
}
}
}

6
ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
using System;
using System.Linq;
using ICSharpCode.Decompiler;
using ICSharpCode.TreeView;
using Mono.Cecil;
@ -78,5 +79,10 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -78,5 +79,10 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, r.FullName);
}
}
}

15
ILSpy/TreeNodes/BaseTypesTreeNode.cs

@ -19,6 +19,8 @@ @@ -19,6 +19,8 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using ICSharpCode.Decompiler;
using ICSharpCode.TreeView;
using Mono.Cecil;
@ -58,6 +60,14 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -58,6 +60,14 @@ namespace ICSharpCode.ILSpy.TreeNodes
children.Add(new BaseTypesEntryNode(i, true));
}
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
EnsureLazyChildren();
foreach (var child in this.Children) {
child.Decompile(language, output, options);
}
}
}
sealed class BaseTypesEntryNode : ILSpyTreeNode<BaseTypesEntryNode>
@ -117,5 +127,10 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -117,5 +127,10 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, language.TypeToString(tr));
}
}
}

6
ILSpy/TreeNodes/ILSpyTreeNode.cs

@ -67,9 +67,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -67,9 +67,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
return text + suffix;
}
public virtual void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
}
public abstract void Decompile(Language language, ITextOutput output, DecompilationOptions options);
/// <summary>
/// Used to implement special view logic for some items.
@ -115,7 +113,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -115,7 +113,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Base class for ILSpy tree nodes.
/// </summary>
class ILSpyTreeNode<T> : ILSpyTreeNodeBase where T : ILSpyTreeNodeBase
abstract class ILSpyTreeNode<T> : ILSpyTreeNodeBase where T : ILSpyTreeNodeBase
{
public ILSpyTreeNode()
: this(new ObservableCollection<T>())

6
ILSpy/TreeNodes/ModuleReferenceTreeNode.cs

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using ICSharpCode.Decompiler;
using ICSharpCode.TreeView;
using Mono.Cecil;
@ -43,5 +44,10 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -43,5 +44,10 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override object Icon {
get { return Images.Library; }
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, r.Name);
}
}
}

4
ILSpy/TreeNodes/NamespaceTreeNode.cs

@ -37,11 +37,11 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -37,11 +37,11 @@ namespace ICSharpCode.ILSpy.TreeNodes
{
if (name == null)
throw new ArgumentNullException("name");
this.name = name.Length == 0 ? "-" : name;
this.name = name;
}
public override object Text {
get { return HighlightSearchMatch(name); }
get { return HighlightSearchMatch(name.Length == 0 ? "-" : name); }
}
public override object Icon {

9
ILSpy/TreeNodes/ReferenceFolderTreeNode.cs

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using ICSharpCode.Decompiler;
using ICSharpCode.TreeView;
using Mono.Cecil;
@ -56,5 +57,13 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -56,5 +57,13 @@ namespace ICSharpCode.ILSpy.TreeNodes
foreach (var r in module.ModuleReferences)
this.Children.Add(new ModuleReferenceTreeNode(r));
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
EnsureLazyChildren();
foreach (var child in this.Children) {
child.Decompile(language, output, options);
}
}
}
}

11
ILSpy/TreeNodes/ResourceListTreeNode.cs

@ -17,7 +17,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -17,7 +17,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Lists the embedded resources in an assembly.
/// </summary>
class ResourceListTreeNode : ILSpyTreeNode<ResourceTreeNode>
sealed class ResourceListTreeNode : ILSpyTreeNode<ResourceTreeNode>
{
readonly ModuleDefinition module;
@ -48,6 +48,15 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -48,6 +48,15 @@ namespace ICSharpCode.ILSpy.TreeNodes
else
return FilterResult.Recurse;
}
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
EnsureLazyChildren();
foreach (var child in this.Children) {
child.Decompile(language, output, options);
output.WriteLine();
}
}
}
class ResourceTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>

Loading…
Cancel
Save