forked from dnSpy/dnSpy
-
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show all bundle entries in the tree view
- Loading branch information
1 parent
d1953f9
commit b5f28de
Showing
10 changed files
with
149 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
dnSpy/dnSpy.Contracts.DnSpy/Documents/TreeView/JsonBundleEntryNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Diagnostics; | ||
|
||
namespace dnSpy.Contracts.Documents.TreeView { | ||
/// <summary> | ||
/// JSON bundle entry node | ||
/// </summary> | ||
public abstract class JsonBundleEntryNode : DocumentTreeNodeData { | ||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
protected JsonBundleEntryNode(BundleEntry bundleEntry) => Debug2.Assert(bundleEntry is not null); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
dnSpy/dnSpy.Contracts.DnSpy/Documents/TreeView/UnknownBundleEntryNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Diagnostics; | ||
|
||
namespace dnSpy.Contracts.Documents.TreeView { | ||
/// <summary> | ||
/// Unknown bundle entry node | ||
/// </summary> | ||
public abstract class UnknownBundleEntryNode : DocumentTreeNodeData { | ||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
protected UnknownBundleEntryNode(BundleEntry bundleEntry) => Debug2.Assert(bundleEntry is not null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Text; | ||
using dnSpy.Contracts.Decompiler; | ||
using dnSpy.Contracts.Documents; | ||
using dnSpy.Contracts.Documents.Tabs.DocViewer; | ||
using dnSpy.Contracts.Documents.TreeView; | ||
using dnSpy.Contracts.Images; | ||
using dnSpy.Contracts.Text; | ||
|
||
namespace dnSpy.Documents.TreeView { | ||
public class JsonBundleEntryNodeImpl : JsonBundleEntryNode, IDecompileSelf { | ||
readonly BundleEntry bundleEntry; | ||
|
||
public JsonBundleEntryNodeImpl(BundleEntry bundleEntry) : base(bundleEntry) => this.bundleEntry = bundleEntry; | ||
|
||
public override Guid Guid => new Guid(DocumentTreeViewConstants.BUNDLE_JSON_ENTRY_NODE_GUID); | ||
|
||
public override NodePathName NodePathName => new NodePathName(Guid); | ||
|
||
protected override ImageReference GetIcon(IDotNetImageService dnImgMgr) => DsImages.TextFile; | ||
|
||
protected override void WriteCore(ITextColorWriter output, IDecompiler decompiler, DocumentNodeWriteOptions options) { | ||
// TODO: better tooltip | ||
output.Write(BoxedTextColor.Text, bundleEntry.FileName); | ||
} | ||
|
||
public bool Decompile(IDecompileNodeContext context) { | ||
//TODO: implement syntax highlighting | ||
context.Output.Write(Encoding.UTF8.GetString(bundleEntry.Data), BoxedTextColor.Text); | ||
return true; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
dnSpy/dnSpy/Documents/TreeView/UnknownBundleEntryNodeImpl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using dnSpy.Contracts.Decompiler; | ||
using dnSpy.Contracts.Documents; | ||
using dnSpy.Contracts.Documents.TreeView; | ||
using dnSpy.Contracts.Images; | ||
using dnSpy.Contracts.Text; | ||
|
||
namespace dnSpy.Documents.TreeView { | ||
sealed class UnknownBundleEntryNodeImpl : UnknownBundleEntryNode { | ||
readonly BundleEntry bundleEntry; | ||
|
||
public UnknownBundleEntryNodeImpl(BundleEntry bundleEntry) : base(bundleEntry) { | ||
this.bundleEntry = bundleEntry; | ||
} | ||
|
||
public override Guid Guid => new Guid(DocumentTreeViewConstants.BUNDLE_UNKNOWN_ENTRY_NODE_GUID); | ||
protected override ImageReference GetIcon(IDotNetImageService dnImgMgr) => DsImages.BinaryFile; | ||
public override NodePathName NodePathName => new NodePathName(Guid); | ||
|
||
protected override void WriteCore(ITextColorWriter output, IDecompiler decompiler, DocumentNodeWriteOptions options) { | ||
// TODO: better tooltip | ||
output.Write(BoxedTextColor.Text, bundleEntry.FileName); | ||
} | ||
} | ||
} |