Compare commits

...

80 commits

Author SHA1 Message Date
Justin Aquadro
15b1b2891f Missing a check in nbtutil 2017-11-24 03:05:29 -05:00
Justin Aquadro
e26a29580a forgot to update typeprinter 2017-11-24 03:02:59 -05:00
Justin Aquadro
d29f249d7e Add support for long array tags 2017-11-24 02:42:34 -05:00
Justin Aquadro
931ac752f5 Fix InnerException reporting 2015-08-10 23:19:56 -04:00
Justin Aquadro
97386a4e5f Updated sln 2015-08-10 23:19:43 -04:00
Justin Aquadro
9d640079b8 Add JSON exporter to NBTUtil 2015-06-16 01:16:31 -04:00
Justin Aquadro
2882fcde17 Add a few more known NBT extensions to the file pattern for directory enumeration. Closes #21. File-based open can already handle all extensions, from #31. 2015-04-18 16:41:58 -04:00
Justin Aquadro
60a7bbf8e9 Add read/modify/delete support for short array tags. As this is nonstandard NBT, creation will not be supported. Will be changed in the future if Mojang updates their specification. 2015-04-18 16:37:10 -04:00
Justin Aquadro
27110539a8 Allow deleting chunks from region files. 2015-04-18 14:23:41 -04:00
Justin Aquadro
5d456cf743 Merge pull request #32 from codewarrior0/open-unknown-as-nbt
When opening files directly, try opening as NBT if no registered filetypes were able to open them.
2015-04-14 02:02:10 -04:00
David Vierra
a279bb281e When opening files directly, try opening as NBT if no registered filetypes were able to open them.
Allows associating *.bpt, *.rs, *.thaum, and other extensions with NBTExplorer.
2015-04-10 21:29:12 -10:00
Justin Aquadro
a9f40fc596 Merge pull request #29 from maruohon/paste-into-empty-list
Allow pasting tags to an empty List. Converts the list's type.
2015-03-18 01:48:55 -04:00
Justin Aquadro
3916b8d362 Merge pull request #28 from codewarrior0/unsort-lists
When sorting the children of a TAG_LIST, preserve the original order.
2015-03-18 01:46:56 -04:00
Matti Ruohonen
26780b841d Allow pasting tags to an empty List. Converts the list's type. 2015-03-17 12:11:34 +02:00
David Vierra
f2688a8f9f When sorting the children of a TAG_LIST, preserve the original order. Order matters for TAG_LISTs. 2015-03-06 00:51:58 -10:00
Justin Aquadro
abde7d87c9 Merge pull request #27 from TepigMC/master
Fixed Typo
2015-03-03 08:02:05 -05:00
Andrew Archibald
3dc86b8b7c Fixed Typo 2015-03-02 21:22:05 -08:00
Justin Aquadro
1fd6ec2680 Add absolute world chunk coordinate to chunk names. 2015-02-28 14:50:42 -05:00
Justin Aquadro
975c11d3d8 Merge pull request #26 from codewarrior0/natural-sort
Change natural comparer to respect negative numbers
2015-02-27 00:11:55 -05:00
David Vierra
7a151d3e6f Change natural comparer to respect negative numbers 2015-02-26 18:53:55 -10:00
Justin Aquadro
db5d2a05c0 Change string compare to natural compare 2015-02-26 23:21:44 -05:00
David Vierra
5c32832281 Make directories sort before files in sort order.
Change identifiers to match existing style.
2015-02-25 23:32:57 -10:00
David Vierra
d8229f7ec5 Add new sort order to NBT Tree view.
Compounds first, then lists, then plain old data, then array types.
2015-02-25 23:23:18 -10:00
Justin Aquadro
fc63457d8e Fix key collision crash in some searches. Add version to About dialog. 2014-09-16 02:04:27 -04:00
Justin Aquadro
d3e53ac559 Update version info 2014-04-01 22:30:08 -04:00
Justin Aquadro
c9014d8b1f Change checkbox behavior on Basic Find 2014-04-01 22:26:05 -04:00
Justin Aquadro
2a043ba09c Fix crash when refreshing nodes with list tag on modified path. 2014-04-01 22:21:38 -04:00
Justin Aquadro
6412629678 Make logging actually succeed 2014-04-01 21:41:45 -04:00
Justin Aquadro
f3304f51a1 Fix crash when refreshing an unexpanded node. Improve error logging. 2014-03-31 20:53:41 -04:00
Justin Aquadro
3e6240d895 Fix array editor disabled 2014-03-31 00:10:39 -04:00
Justin Aquadro
e1096e29ca fix absolute path crash 2014-02-20 02:23:38 -05:00
Justin Aquadro
b303551fa0 Update installer version 2014-02-20 02:03:45 -05:00
Justin Aquadro
16ec47a411 File organization; added wildcard and glob matching to NBTUtil paths 2014-02-20 01:58:40 -05:00
Justin Aquadro
c5debf12d4 Fix bugs in search rule matching 2014-02-19 20:29:22 -05:00
Justin Aquadro
d4ad1bd99a Restructuring project to support separate command-line utility 2014-02-16 02:56:27 -05:00
Justin Aquadro
a03537bb99 Add Open in Explorer to context menu 2013-12-18 23:12:42 -05:00
Justin Aquadro
2d70d2af10 Merge branch 'master' of https://github.com/flarn2006/NBTExplorer 2013-12-18 22:47:27 -05:00
Justin Aquadro
5d51967501 Try to improve control flicker 2013-12-18 22:45:05 -05:00
flarn2006
ab4e789114 Added a menu item to open a directory in Explorer 2013-12-17 19:39:21 -05:00
flarn2006
b642b3aee4 Don't want to mess with the keyboard shortcut
See previous commit/added comments
2013-12-17 19:24:15 -05:00
flarn2006
400eb1f80a Hold down Ctrl to avoid using folder browse dlg
That dialog just plain sucks...you can't type in a path, for instance.
2013-12-17 19:17:15 -05:00
Justin Aquadro
366ec3fe9e More rigorous startup failure checking and reporting 2013-11-17 13:26:19 -05:00
Justin Aquadro
b2d54f39a6 Reorganize project structure; Add installer project 2013-11-09 22:57:24 -05:00
Justin Aquadro
ed6b69978e Add Chunk Finder tool to search menu 2013-11-09 20:09:22 -05:00
Justin Aquadro
9f44174887 Version bump 2013-11-01 22:19:50 -04:00
Justin Aquadro
85ca29cb79 Fixed regression in node controller preventing creation of new nodes. 2013-11-01 22:18:20 -04:00
Justin Aquadro
ae03136b5b Missing source file 2013-11-01 00:49:44 -04:00
Justin Aquadro
346adf297a Polish up find/replace, other bits of polish 2013-11-01 00:48:44 -04:00
Justin Aquadro
14444dd1b5 Replace-All seems to be working 2013-10-30 01:43:20 -04:00
Justin Aquadro
a8cf67b8f4 ExplorerBar on find/replace 2013-10-29 22:17:07 -04:00
Justin Aquadro
26a727e41e Merge remote-tracking branch 'origin/feature-replace' into feature-replace
Conflicts:
	Windows/EditHex.Designer.cs
	Windows/EditHex.cs
	Windows/FindReplace.Designer.cs
	Windows/FindReplace.resx
2013-10-29 22:16:22 -04:00
Justin Aquadro
168557c8e9 Intermediate state 2013-10-28 23:30:39 -04:00
Justin Aquadro
276a5c6747 Update find menu/button appropriately at end of search 2013-10-06 21:50:11 -04:00
Justin Aquadro
a700d4c128 Add text-based array editing; open editing for Mono-based runtimes 2013-10-06 21:43:12 -04:00
Justin Aquadro
db1662dc9b Ready for search and replace beta release (no replace-all yet) 2013-08-10 02:11:04 -04:00
Justin Aquadro
152213e2cf Implementing progress callback 2013-08-09 02:02:22 -04:00
Justin Aquadro
1c654c66d3 Create rule forms 2013-08-08 22:48:05 -04:00
Justin Aquadro
48fc7e4d0e Find/Replace progress 2013-08-08 01:21:51 -04:00
Justin Aquadro
feac98b064 Rule tree code 2013-08-07 01:19:04 -04:00
Justin Aquadro
1ccf299f9c Merge branch 'master' into feature-replace
Conflicts:
	Vendor/MultiSelectTreeView/MultiSelectTreeview.cs
	Windows/MainForm.cs
2013-08-06 21:35:31 -04:00
Justin Aquadro
22a14a9554 Sorting on NBT File Node contents 2013-05-25 17:31:41 -04:00
Justin Aquadro
563ca5b0a5 Text list representation import/export for array types 2013-05-25 17:12:37 -04:00
Justin Aquadro
e319c519dc Raw byte array import/export 2013-05-25 03:30:52 -04:00
Justin Aquadro
119ba72091 Update Substrate; Version 2013-05-25 01:15:38 -04:00
Justin Aquadro
09806d5f14 Somewhat reduce flickering on select changes 2013-05-25 01:11:05 -04:00
Justin Aquadro
00cc08bb05 Expand Children / Expand Tree context menu items 2013-05-25 00:11:21 -04:00
Justin Aquadro
2c0ce45b37 NBT fix in Substrate; Error reporting on file load failure; Open file dialog type filtering 2013-05-24 23:30:58 -04:00
Justin Aquadro
f956912dfb Updating Substrate reference to fix file padding bug 2013-03-09 14:06:40 -05:00
Justin Aquadro
19e304ab04 Check %APPDATA% for Minecraft dir first 2013-02-18 01:38:33 -05:00
Justin Aquadro
15d27c1ff9 Update version number, add Substrate as project support file 2013-02-05 23:38:52 -05:00
Justin Aquadro
8f092842e9 Byte and Int arrays can be modified to different lengths 2013-02-05 23:35:01 -05:00
Justin Aquadro
d27234e2cd Added root node renaming and container manipulation capability 2013-02-05 02:14:52 -05:00
Justin Aquadro
24c349ce50 Tighter protection around unpredictable ApplicationSettings properties 2013-01-27 19:42:48 -05:00
Justin Aquadro
d0f125632f Replace form progress 2012-11-20 01:02:35 -05:00
Justin Aquadro
1aea80c7fd Merging master 2012-11-17 20:48:47 -05:00
Justin Aquadro
1596d3365d Multi-select support (for delete) 2012-11-15 00:27:35 -05:00
Justin Aquadro
b927f06b95 Fixed node cutting/deleting not triggering isModified state 2012-11-14 20:48:25 -05:00
Justin Aquadro
fb6c063d5d Initial work on advanced find/replace 2012-11-14 20:14:45 -05:00
Justin Aquadro
d0c521c500 Added node refresh capability 2012-11-11 13:52:12 -05:00
Justin Aquadro
d2025b167e Removing forms folder 2012-11-11 01:21:08 -05:00
283 changed files with 14433 additions and 2664 deletions

5
.gitignore vendored
View file

@ -2,4 +2,7 @@ bin
obj
*.suo
*.user
*.cache
*.cache
*.userprefs
Staging/
UpgradeLog*.htm

View file

@ -1,24 +0,0 @@
using Substrate.Core;
namespace NBTExplorer.Model
{
public class CubicRegionFile : RegionFile
{
private const int _sectorBytes = 256;
private static byte[] _emptySector = new byte[_sectorBytes];
public CubicRegionFile (string path)
: base(path)
{ }
protected override int SectorBytes
{
get { return _sectorBytes; }
}
protected override byte[] EmptySector
{
get { return _emptySector; }
}
}
}

View file

@ -1,215 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class DataNode
{
private DataNode _parent;
private DataNodeCollection _children;
private bool _expanded;
private bool _modified;
public DataNode ()
{
_children = new DataNodeCollection(this);
}
public DataNode Parent
{
get { return _parent; }
internal set { _parent = value; }
}
public DataNodeCollection Nodes
{
get { return _children; }
}
public bool IsModified
{
get { return _modified; }
set
{
if (value && Parent != null)
Parent.IsModified = value;
_modified = value;
}
}
public bool IsExpanded
{
get { return _expanded; }
private set { _expanded = value; }
}
public void Expand ()
{
if (!IsExpanded) {
ExpandCore();
IsExpanded = true;
}
}
protected virtual void ExpandCore () { }
public void Collapse ()
{
if (IsExpanded && !IsModified) {
Release();
IsExpanded = false;
}
}
public void Release ()
{
foreach (DataNode node in Nodes)
node.Release();
ReleaseCore();
IsExpanded = false;
}
protected virtual void ReleaseCore ()
{
Nodes.Clear();
}
public void Save ()
{
foreach (DataNode node in Nodes)
if (node.IsModified)
node.Save();
SaveCore();
IsModified = false;
}
protected virtual void SaveCore ()
{
}
public virtual string NodeName
{
get { return ""; }
}
public virtual string NodeDisplay
{
get { return ""; }
}
public virtual bool HasUnexpandedChildren
{
get { return false; }
}
#region Capabilities
protected virtual NodeCapabilities Capabilities
{
get { return NodeCapabilities.None; }
}
public virtual bool CanRenameNode
{
get { return (Capabilities & NodeCapabilities.Rename) != NodeCapabilities.None; }
}
public virtual bool CanEditNode
{
get { return (Capabilities & NodeCapabilities.Edit) != NodeCapabilities.None; }
}
public virtual bool CanDeleteNode
{
get { return (Capabilities & NodeCapabilities.Delete) != NodeCapabilities.None; }
}
public virtual bool CanCopyNode
{
get { return (Capabilities & NodeCapabilities.Copy) != NodeCapabilities.None; }
}
public virtual bool CanCutNode
{
get { return (Capabilities & NodeCapabilities.Cut) != NodeCapabilities.None; }
}
public virtual bool CanPasteIntoNode
{
get { return (Capabilities & NodeCapabilities.PasteInto) != NodeCapabilities.None; }
}
public virtual bool CanSearchNode
{
get { return (Capabilities & NodeCapabilities.Search) != NodeCapabilities.None; }
}
public virtual bool CanReoderNode
{
get { return (Capabilities & NodeCapabilities.Reorder) != NodeCapabilities.None; }
}
public virtual bool CanMoveNodeUp
{
get { return false; }
}
public virtual bool CanMoveNodeDown
{
get { return false; }
}
public virtual bool CanCreateTag (TagType type)
{
return false;
}
#endregion
#region Operations
public virtual bool CreateNode (TagType type)
{
return false;
}
public virtual bool RenameNode ()
{
return false;
}
public virtual bool EditNode ()
{
return false;
}
public virtual bool DeleteNode ()
{
return false;
}
public virtual bool CopyNode ()
{
return false;
}
public virtual bool CutNode ()
{
return false;
}
public virtual bool PasteNode ()
{
return false;
}
public virtual bool ChangeRelativePosition (int offset)
{
return false;
}
#endregion
}
}

View file

@ -1,38 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class ListTagContainer : IOrderedTagContainer
{
private TagNodeList _tag;
public ListTagContainer (TagNodeList tag)
{
_tag = tag;
}
public int TagCount
{
get { return _tag.Count; }
}
public bool DeleteTag (TagNode tag)
{
return _tag.Remove(tag);
}
public int GetTagIndex (TagNode tag)
{
return _tag.IndexOf(tag);
}
public bool InsertTag (TagNode tag, int index)
{
if (index < 0 || index > _tag.Count)
return false;
_tag.Insert(index, tag);
return true;
}
}
}

View file

@ -1,141 +0,0 @@
using System.IO;
using System.Text.RegularExpressions;
using Substrate.Core;
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class NbtFileDataNode : DataNode, IMetaTagContainer
{
private NbtTree _tree;
private string _path;
private CompressionType _compressionType;
private CompoundTagContainer _container;
private static Regex _namePattern = new Regex(@"\.(dat|nbt|schematic)$");
private NbtFileDataNode (string path, CompressionType compressionType)
{
_path = path;
_compressionType = compressionType;
_container = new CompoundTagContainer(new TagNodeCompound());
}
public static NbtFileDataNode TryCreateFrom (string path)
{
return TryCreateFrom(path, CompressionType.GZip)
?? TryCreateFrom(path, CompressionType.None);
}
private static NbtFileDataNode TryCreateFrom (string path, CompressionType compressionType)
{
try {
NBTFile file = new NBTFile(path);
NbtTree tree = new NbtTree();
tree.ReadFrom(file.GetDataInputStream(compressionType));
if (tree.Root == null)
return null;
return new NbtFileDataNode(path, compressionType);
}
catch {
return null;
}
}
public static bool SupportedNamePattern (string path)
{
path = Path.GetFileName(path);
return _namePattern.IsMatch(path);
}
protected override NodeCapabilities Capabilities
{
get
{
return NodeCapabilities.CreateTag
| NodeCapabilities.PasteInto
| NodeCapabilities.Search;
}
}
public override string NodeName
{
get { return Path.GetFileName(_path); }
}
public override string NodeDisplay
{
get { return NodeName; }
}
public override bool HasUnexpandedChildren
{
get { return !IsExpanded; }
}
protected override void ExpandCore ()
{
if (_tree == null) {
NBTFile file = new NBTFile(_path);
_tree = new NbtTree();
_tree.ReadFrom(file.GetDataInputStream(_compressionType));
if (_tree.Root != null)
_container = new CompoundTagContainer(_tree.Root);
}
foreach (TagNode tag in _tree.Root.Values) {
TagDataNode node = TagDataNode.CreateFromTag(tag);
if (node != null)
Nodes.Add(node);
}
}
protected override void ReleaseCore ()
{
_tree = null;
Nodes.Clear();
}
protected override void SaveCore ()
{
NBTFile file = new NBTFile(_path);
using (Stream str = file.GetDataOutputStream(_compressionType)) {
_tree.WriteTo(str);
}
}
public bool IsNamedContainer
{
get { return true; }
}
public bool IsOrderedContainer
{
get { return false; }
}
public INamedTagContainer NamedTagContainer
{
get { return _container; }
}
public IOrderedTagContainer OrderedTagContainer
{
get { return null; }
}
public int TagCount
{
get { return _container.TagCount; }
}
public bool DeleteTag (TagNode tag)
{
return _container.DeleteTag(tag);
}
}
}

View file

@ -1,19 +0,0 @@
using System;
namespace NBTExplorer.Model
{
[Flags]
public enum NodeCapabilities
{
None = 0,
Cut = 0x1,
Copy = 0x2,
PasteInto = 0x4,
Rename = 0x8,
Edit = 0x10,
Delete = 0x20,
CreateTag = 0x40,
Search = 0x80,
Reorder = 0x100,
}
}

View file

@ -1,16 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class TagDoubleDataNode : TagDataNode
{
public TagDoubleDataNode (TagNodeDouble tag)
: base(tag)
{ }
public override bool EditNode ()
{
return EditScalarValue(Tag);
}
}
}

View file

@ -1,16 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class TagFloatDataNode : TagDataNode
{
public TagFloatDataNode (TagNodeFloat tag)
: base(tag)
{ }
public override bool EditNode ()
{
return EditScalarValue(Tag);
}
}
}

View file

@ -1,16 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class TagIntDataNode : TagDataNode
{
public TagIntDataNode (TagNodeInt tag)
: base(tag)
{ }
public override bool EditNode ()
{
return EditScalarValue(Tag);
}
}
}

View file

@ -1,16 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class TagLongDataNode : TagDataNode
{
public TagLongDataNode (TagNodeLong tag)
: base(tag)
{ }
public override bool EditNode ()
{
return EditScalarValue(Tag);
}
}
}

View file

@ -1,16 +0,0 @@
using Substrate.Nbt;
namespace NBTExplorer.Model
{
public class TagShortDataNode : TagDataNode
{
public TagShortDataNode (TagNodeShort tag)
: base(tag)
{ }
public override bool EditNode ()
{
return EditScalarValue(Tag);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.8</ProductVersion>
<ProjectGuid>a1566071-7cbb-4c54-aae1-4b81b7715db3</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>NBTExplorer</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<Content Include="Bitmaps\Banner.png" />
<Content Include="Bitmaps\Dialog.png" />
<Content Include="Icon.ico" />
<Content Include="License.rtf" />
</ItemGroup>
<ItemGroup>
<Folder Include="Bitmaps" />
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="NBTExplorer"
Language="1033"
Version="2.8.0.0"
Manufacturer="Justin Aquadro"
UpgradeCode="0bfb1026-21f2-4552-ad71-ca90aae10a25">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
<UI>
<UIRef Id="WixUI_InstallDir" />
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="CA.LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="Bitmaps/Banner.png" />
<WixVariable Id="WixUIDialogBmp" Value="Bitmaps/Dialog.png" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch NBTExplorer" />
<Property Id="WixShellExecTarget" Value="[#NBTExplorer.exe]" />
<CustomAction Id="CA.LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Icon Id="I.MainIcon" SourceFile="Icon.ico" />
<Property Id="ARPPRODUCTICON" Value="I.MainIcon" />
<Feature Id="F.MainApplication" Title="NBTExplorer" Level="1">
<ComponentGroupRef Id="CG.StartMenu" />
<ComponentGroupRef Id="CG.ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="D.StartFolder" Name="NBTExplorer" />
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="NBTExplorer" />
</Directory>
</Directory>
<ComponentGroup Id="CG.StartMenu" Directory="D.StartFolder">
<Component Id="C.NBTEShortcut" Guid="*">
<Shortcut Id="S.NBTEShortcut"
Name="NBTExplorer"
Target="[INSTALLDIR]NBTExplorer.exe"
WorkingDirectory="INSTALLDIR" />
<RemoveFolder Id="RF.StartFolder" On="uninstall" />
<RegistryValue Id="RV.NBTEShortcut" Root="HKCU" Key="Software\NBTExplorer" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="C.Uninstall" Guid="*">
<Shortcut Id="S.Uninstall"
Name="Uninstall NBTExplorer"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Uninstalls the NBTExplorer Application" />
<RemoveFolder Id="RF.Uninstall" On ="uninstall" />
<RegistryValue Id="RV.Uninstall" Root="HKCU" Key="Software\NBTExplorer" Name="uninstall" Type="integer" Value="1" KeyPath="yes" />
</Component>
</ComponentGroup>
<ComponentGroup Id="CG.ProductComponents" Directory="INSTALLDIR">
<Component Id="C.NBTExplorer.exe" Guid="*">
<File Source="../Staging/NBTExplorer.exe" KeyPath="yes" />
</Component>
<Component Id="C.NBTExplorer.exe.config" Guid="*">
<File Source="../Staging/NBTExplorer.exe.config" KeyPath="yes" />
</Component>
<Component Id="C.NBTExplorer.visualelementsmanifest.xml" Guid="*">
<File Source="../Staging/Windows/NBTExplorer.visualelementsmanifest.xml" KeyPath="yes" />
</Component>
<Component Id="C.NBTUtil.exe" Guid="*">
<File Source="../Staging/NBTUtil.exe" KeyPath="yes" />
</Component>
<Component Id="C.NBTUtil.exe.config" Guid="*">
<File Source="../Staging/NBTUtil.exe.config" KeyPath="yes" />
</Component>
<Component Id="C.NBTModel.dll" Guid="*">
<File Source="../Staging/NBTModel.dll" KeyPath="yes" />
</Component>
<Component Id="C.Substrate.dll" Guid="*">
<File Source="../Staging/Substrate.dll" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

View file

@ -1,54 +1,123 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBTExplorer", "NBTExplorer.csproj", "{8A458245-8176-4599-95CD-3CA39F2435CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBTExplorerMac", "NBTExplorerMac.csproj", "{01F9A296-C477-4CBF-A0D0-41E697048257}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
AppStore|Any CPU = AppStore|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{01F9A296-C477-4CBF-A0D0-41E697048257}.AppStore|Any CPU.ActiveCfg = AppStore|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.AppStore|Any CPU.Build.0 = AppStore|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Debug|x86.ActiveCfg = Debug|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Debug|x86.Build.0 = Debug|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Release|Any CPU.Build.0 = Release|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Release|x86.ActiveCfg = Release|Any CPU
{01F9A296-C477-4CBF-A0D0-41E697048257}.Release|x86.Build.0 = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|Any CPU.ActiveCfg = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|Any CPU.Build.0 = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|x86.ActiveCfg = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|x86.Build.0 = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Any CPU.Build.0 = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|x86.ActiveCfg = Release|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = NBTExplorerMac.csproj
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBTExplorer", "NBTExplorer\NBTExplorer.csproj", "{8A458245-8176-4599-95CD-3CA39F2435CE}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "NBTExplorer.Installer", "NBTExplorer.Installer\NBTExplorer.Installer.wixproj", "{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}"
ProjectSection(ProjectDependencies) = postProject
{8A458245-8176-4599-95CD-3CA39F2435CE} = {8A458245-8176-4599-95CD-3CA39F2435CE}
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC} = {20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF} = {BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBTUtil", "NBTUtil\NBTUtil.csproj", "{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBTModel", "NBTModel\NBTModel.csproj", "{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Substrate (NET2)", "..\Substrate\SubstrateCS\Substrate (NET2).csproj", "{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
AppStore|Any CPU = AppStore|Any CPU
AppStore|Mixed Platforms = AppStore|Mixed Platforms
AppStore|x86 = AppStore|x86
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|Any CPU.ActiveCfg = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|Any CPU.Build.0 = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|Mixed Platforms.ActiveCfg = Release|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|Mixed Platforms.Build.0 = Release|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|x86.ActiveCfg = Release|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.AppStore|x86.Build.0 = Release|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|x86.ActiveCfg = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|x86.Build.0 = Debug|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Any CPU.Build.0 = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|x86.ActiveCfg = Release|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|x86.Build.0 = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.AppStore|Any CPU.ActiveCfg = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.AppStore|Mixed Platforms.ActiveCfg = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.AppStore|Mixed Platforms.Build.0 = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.AppStore|x86.ActiveCfg = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.AppStore|x86.Build.0 = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Debug|Any CPU.ActiveCfg = Debug|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Debug|x86.ActiveCfg = Debug|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Debug|x86.Build.0 = Debug|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Release|Any CPU.ActiveCfg = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Release|Mixed Platforms.Build.0 = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Release|x86.ActiveCfg = Release|x86
{A1566071-7CBB-4C54-AAE1-4B81B7715DB3}.Release|x86.Build.0 = Release|x86
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.AppStore|Any CPU.Build.0 = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.AppStore|x86.ActiveCfg = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Debug|x86.ActiveCfg = Debug|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Release|Any CPU.Build.0 = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BD90EED5-97B9-47D5-AFEA-C2C0D0E59FCF}.Release|x86.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.AppStore|Any CPU.Build.0 = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.AppStore|x86.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Debug|x86.ActiveCfg = Debug|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Release|Any CPU.Build.0 = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Release|x86.ActiveCfg = Release|Any CPU
{20D7CBA3-5B6D-40B0-8D28-4C9A58E4FFBC}.Release|x86.Build.0 = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.AppStore|Any CPU.Build.0 = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.AppStore|x86.ActiveCfg = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.AppStore|x86.Build.0 = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|x86.ActiveCfg = Debug|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|x86.Build.0 = Debug|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|Any CPU.Build.0 = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|x86.ActiveCfg = Release|Any CPU
{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = NBTExplorerMac.csproj
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using NBTExplorer.Model;
using NBTExplorer.Windows;
namespace NBTExplorer.Controllers
{
class ExplorerBarController
{
private ToolStrip _explorerStrip;
private DataNode _rootNode;
private IconRegistry _registry;
private ImageList _iconList;
public ExplorerBarController (ToolStrip toolStrip, IconRegistry registry, ImageList iconList, DataNode rootNode)
{
_explorerStrip = toolStrip;
_registry = registry;
_iconList = iconList;
_rootNode = rootNode;
Initialize();
}
private void Initialize ()
{
_explorerStrip.Items.Clear();
List<DataNode> ancestry = new List<DataNode>();
DataNode node = _rootNode;
while (node != null) {
ancestry.Add(node);
node = node.Parent;
}
ancestry.Reverse();
foreach (DataNode item in ancestry) {
ToolStripSplitButton itemButton = new ToolStripSplitButton(item.NodePathName) {
Tag = item,
};
itemButton.ButtonClick += (s, e) => {
ToolStripSplitButton button = s as ToolStripSplitButton;
if (button != null)
SearchRoot = button.Tag as DataNode;
};
itemButton.DropDown.ImageList = _iconList;
if (_explorerStrip.Items.Count == 0)
itemButton.ImageIndex = _registry.Lookup(item.GetType());
if (!item.IsExpanded)
item.Expand();
foreach (DataNode subItem in item.Nodes) {
if (!subItem.IsContainerType)
continue;
ToolStripMenuItem menuItem = new ToolStripMenuItem(subItem.NodePathName) {
ImageIndex = _registry.Lookup(subItem.GetType()),
Tag = subItem,
};
menuItem.Click += (s, e) => {
ToolStripMenuItem mItem = s as ToolStripMenuItem;
if (mItem != null)
SearchRoot = mItem.Tag as DataNode;
};
if (ancestry.Contains(subItem))
menuItem.Font = new Font(menuItem.Font, FontStyle.Bold);
itemButton.DropDownItems.Add(menuItem);
}
_explorerStrip.Items.Add(itemButton);
}
}
public DataNode SearchRoot
{
get { return _rootNode; }
set
{
if (_rootNode == value)
return;
_rootNode = value;
Initialize();
OnSearchRootChanged();
}
}
public event EventHandler SearchRootChanged;
protected virtual void OnSearchRootChanged ()
{
var ev = SearchRootChanged;
if (ev != null)
ev(this, EventArgs.Empty);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,438 @@
using System.Windows.Forms;
using NBTExplorer.Model.Search;
using NBTExplorer.Windows;
using NBTExplorer.Windows.Search;
using Substrate.Nbt;
namespace NBTExplorer.Controllers
{
public class RuleTreeController
{
private TreeView _nodeTree;
private IconRegistry _iconRegistry;
private RootRule _rootData;
public RuleTreeController (TreeView nodeTree)
{
_nodeTree = nodeTree;
InitializeIconRegistry();
ShowVirtualRoot = true;
_rootData = new RootRule();
RefreshTree();
}
private void InitializeIconRegistry ()
{
_iconRegistry = new IconRegistry();
_iconRegistry.DefaultIcon = 15;
_iconRegistry.Register(typeof(RootRule), 18);
_iconRegistry.Register(typeof(UnionRule), 21);
_iconRegistry.Register(typeof(IntersectRule), 20);
_iconRegistry.Register(typeof(WildcardRule), 19);
_iconRegistry.Register(typeof(ByteTagRule), 0);
_iconRegistry.Register(typeof(ShortTagRule), 1);
_iconRegistry.Register(typeof(IntTagRule), 2);
_iconRegistry.Register(typeof(LongTagRule), 3);
_iconRegistry.Register(typeof(FloatTagRule), 4);
_iconRegistry.Register(typeof(DoubleTagRule), 5);
_iconRegistry.Register(typeof(StringTagRule), 7);
}
public RootRule Root
{
get { return _rootData; }
}
public TreeView Tree
{
get { return _nodeTree; }
}
public bool ShowVirtualRoot { get; set; }
public string VirtualRootDisplay
{
get { return _rootData.NodeDisplay; }
}
public void DeleteSelection ()
{
DeleteNode(SelectedNode);
}
public void DeleteNode (TreeNode node)
{
if (node == null || !(node.Tag is SearchRule))
return;
TreeNode parent = node.Parent;
if (parent == null || !(parent.Tag is GroupRule))
return;
GroupRule parentData = parent.Tag as GroupRule;
SearchRule nodeData = node.Tag as SearchRule;
parentData.Rules.Remove(nodeData);
parent.Nodes.Remove(node);
}
private TreeNode SelectedNode
{
get { return _nodeTree.SelectedNode; }
}
private TreeNode SelectedOrRootNode
{
get { return _nodeTree.SelectedNode ?? (_nodeTree.Nodes.Count > 0 ? _nodeTree.Nodes[0] : null); }
}
private TreeNode CreateIntegralNode<T, K> (string typeName)
where K : TagNode
where T : IntegralTagRule<K>, new()
{
T rule = new T();
using (ValueRuleForm form = new ValueRuleForm(SearchRule.NumericOpStrings) {
Text = "Edit " + typeName + " Tag Rule",
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValueAsLong;
rule.Operator = form.Operator;
}
else
return null;
}
TreeNode node = CreateNode(rule);
node.Text = rule.NodeDisplay;
return node;
}
private void EditIntegralNode<T, K> (TreeNode node, T rule, string typeName)
where K : TagNode
where T : IntegralTagRule<K>
{
using (ValueRuleForm form = new ValueRuleForm(SearchRule.NumericOpStrings) {
Text = "Edit " + typeName + " Tag Rule",
TagName = rule.Name,
TagValue = rule.Value.ToString(),
Operator = rule.Operator,
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValueAsLong;
rule.Operator = form.Operator;
}
}
node.Text = rule.NodeDisplay;
}
private TreeNode CreateFloatNode<T, K> (string typeName)
where K : TagNode
where T : FloatTagRule<K>, new()
{
T rule = new T();
using (ValueRuleForm form = new ValueRuleForm(SearchRule.NumericOpStrings) {
Text = "Edit " + typeName + " Tag Rule",
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValueAsDouble;
rule.Operator = form.Operator;
}
else
return null;
}
TreeNode node = CreateNode(rule);
node.Text = rule.NodeDisplay;
return node;
}
private void EditFloatNode<T, K> (TreeNode node, T rule, string typeName)
where K : TagNode
where T : FloatTagRule<K>
{
using (ValueRuleForm form = new ValueRuleForm(SearchRule.NumericOpStrings) {
Text = "Edit " + typeName + " Tag Rule",
TagName = rule.Name,
TagValue = rule.Value.ToString(),
Operator = rule.Operator,
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValueAsDouble;
rule.Operator = form.Operator;
}
}
node.Text = rule.NodeDisplay;
}
private TreeNode CreateStringNode (string typeName)
{
StringTagRule rule = new StringTagRule();
using (StringRuleForm form = new StringRuleForm(SearchRule.StringOpStrings) {
Text = "Edit " + typeName + " Tag Rule",
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValue;
rule.Operator = form.Operator;
}
else
return null;
}
TreeNode node = CreateNode(rule);
node.Text = rule.NodeDisplay;
return node;
}
private void EditStringNode (TreeNode node, StringTagRule rule, string typeName)
{
using (StringRuleForm form = new StringRuleForm(SearchRule.StringOpStrings) {
Text = "Edit " + typeName + " Tag Rule",
TagName = rule.Name,
TagValue = rule.Value,
Operator = rule.Operator,
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValue;
rule.Operator = form.Operator;
}
}
node.Text = rule.NodeDisplay;
}
private TreeNode CreateWildcardNode (string typeName)
{
WildcardRule rule = new WildcardRule();
using (WildcardRuleForm form = new WildcardRuleForm(SearchRule.WildcardOpStrings) {
Text = "Edit " + typeName + " Rule",
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValue;
rule.Operator = form.Operator;
}
else
return null;
}
TreeNode node = CreateNode(rule);
node.Text = rule.NodeDisplay;
return node;
}
private void EditWildcardNode (TreeNode node, WildcardRule rule, string typeName)
{
using (WildcardRuleForm form = new WildcardRuleForm(SearchRule.WildcardOpStrings) {
Text = "Edit " + typeName + " Rule",
TagName = rule.Name,
TagValue = rule.Value,
Operator = rule.Operator,
}) {
if (form.ShowDialog() == DialogResult.OK) {
rule.Name = form.TagName;
rule.Value = form.TagValue;
rule.Operator = form.Operator;
}
}
node.Text = rule.NodeDisplay;
}
public void CreateNode (TreeNode node, TagType type)
{
if (node == null || !(node.Tag is GroupRule))
return;
GroupRule dataNode = node.Tag as GroupRule;
TreeNode newNode = null;
switch (type) {
case TagType.TAG_BYTE:
newNode = CreateIntegralNode<ByteTagRule, TagNodeByte>("Byte");
break;
case TagType.TAG_SHORT:
newNode = CreateIntegralNode<ShortTagRule, TagNodeShort>("Short");
break;
case TagType.TAG_INT:
newNode = CreateIntegralNode<IntTagRule, TagNodeInt>("Int");
break;
case TagType.TAG_LONG:
newNode = CreateIntegralNode<LongTagRule, TagNodeLong>("Long");
break;
case TagType.TAG_FLOAT:
newNode = CreateFloatNode<FloatTagRule, TagNodeFloat>("Float");
break;
case TagType.TAG_DOUBLE:
newNode = CreateFloatNode<DoubleTagRule, TagNodeDouble>("Double");
break;
case TagType.TAG_STRING:
newNode = CreateStringNode("String");
break;
}
if (newNode != null) {
node.Nodes.Add(newNode);
dataNode.Rules.Add(newNode.Tag as SearchRule);
node.Expand();
}
}
public void EditNode (TreeNode node)
{
if (node == null || !(node.Tag is SearchRule))
return;
SearchRule rule = node.Tag as SearchRule;
if (rule is ByteTagRule)
EditIntegralNode<ByteTagRule, TagNodeByte>(node, rule as ByteTagRule, "Byte");
else if (rule is ShortTagRule)
EditIntegralNode<ShortTagRule, TagNodeShort>(node, rule as ShortTagRule, "Short");
else if (rule is IntTagRule)
EditIntegralNode<IntTagRule, TagNodeInt>(node, rule as IntTagRule, "Int");
else if (rule is LongTagRule)
EditIntegralNode<LongTagRule, TagNodeLong>(node, rule as LongTagRule, "Long");
else if (rule is FloatTagRule)
EditFloatNode<FloatTagRule, TagNodeFloat>(node, rule as FloatTagRule, "Float");
else if (rule is DoubleTagRule)
EditFloatNode<DoubleTagRule, TagNodeDouble>(node, rule as DoubleTagRule, "Double");
else if (rule is StringTagRule)
EditStringNode(node, rule as StringTagRule, "String");
else if (rule is WildcardRule)
EditWildcardNode(node, rule as WildcardRule, "Wildcard");
}
public void EditSelection ()
{
if (_nodeTree.SelectedNode == null)
return;
EditNode(_nodeTree.SelectedNode);
}
public void CreateWildcardNode (TreeNode node)
{
if (node == null || !(node.Tag is GroupRule))
return;
GroupRule dataNode = node.Tag as GroupRule;
TreeNode newNode = CreateWildcardNode("Wildcard");
if (newNode != null) {
node.Nodes.Add(newNode);
dataNode.Rules.Add(newNode.Tag as SearchRule);
node.Expand();
}
}
public void CreateWildcardNode ()
{
CreateWildcardNode(SelectedOrRootNode);
}
public void CreateUnionNode (TreeNode node)
{
if (node == null || !(node.Tag is GroupRule))
return;
GroupRule dataNode = node.Tag as GroupRule;
TreeNode newNode = CreateNode(new UnionRule());
node.Nodes.Add(newNode);
dataNode.Rules.Add(newNode.Tag as SearchRule);
node.Expand();
}
public void CreateUnionNode ()
{
CreateUnionNode(SelectedOrRootNode);
}
public void CreateIntersectNode (TreeNode node)
{
if (node == null || !(node.Tag is GroupRule))
return;
GroupRule dataNode = node.Tag as GroupRule;
TreeNode newNode = CreateNode(new IntersectRule());
node.Nodes.Add(newNode);
dataNode.Rules.Add(newNode.Tag as SearchRule);
node.Expand();
}
public void CreateIntersectNode ()
{
CreateIntersectNode(SelectedOrRootNode);
}
public void CreateNode (TagType type)
{
if (SelectedOrRootNode == null)
return;
CreateNode(SelectedOrRootNode, type);
}
private TreeNode CreateNode (SearchRule rule)
{
TreeNode frontNode = new TreeNode(rule.NodeDisplay);
frontNode.ImageIndex = _iconRegistry.Lookup(rule.GetType());
frontNode.SelectedImageIndex = frontNode.ImageIndex;
frontNode.Tag = rule;
return frontNode;
}
private void ExpandNode (TreeNode node, bool recurse)
{
GroupRule rule = node.Tag as GroupRule;
if (rule == null)
return;
foreach (var subRule in rule.Rules) {
TreeNode subNode = CreateNode(subRule);
node.Nodes.Add(subNode);
if (recurse)
ExpandNode(subNode, recurse);
}
}
private void RefreshTree ()
{
_nodeTree.Nodes.Clear();
_nodeTree.Nodes.Add(CreateNode(_rootData));
ExpandNode(_nodeTree.Nodes[0], true);
_nodeTree.ExpandAll();
}
}
}

60
NBTExplorer/Interop.cs Normal file
View file

@ -0,0 +1,60 @@
using System;
using System.Runtime.InteropServices;
namespace NBTExplorer
{
internal static class Interop
{
public static bool WinInteropAvailable
{
get { return IsWindows && Type.GetType("Mono.Runtime") == null; }
}
public static bool IsWindows
{
get { return Environment.OSVersion.Platform == PlatformID.Win32NT; }
}
public static bool IsWinXP
{
get
{
OperatingSystem OS = Environment.OSVersion;
return (OS.Platform == PlatformID.Win32NT) &&
((OS.Version.Major > 5) || ((OS.Version.Major == 5) && (OS.Version.Minor == 1)));
}
}
public static bool IsWinVista
{
get
{
OperatingSystem OS = Environment.OSVersion;
return (OS.Platform == PlatformID.Win32NT) && (OS.Version.Major >= 6);
}
}
public static IntPtr SendMessage (IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
{
if (WinInteropAvailable)
return NativeInterop.SendMessage(hWnd, msg, wParam, lParam);
else
return IntPtr.Zero;
}
}
internal static class NativeInterop
{
public const int WM_PRINTCLIENT = 0x0318;
public const int PRF_CLIENT = 0x00000004;
public const int TV_FIRST = 0x1100;
public const int TVM_SETBKCOLOR = TV_FIRST + 29;
public const int TVM_SETEXTENDEDSTYLE = TV_FIRST + 44;
public const int TVS_EX_DOUBLEBUFFER = 0x0004;
[DllImport("user32.dll")]
public static extern IntPtr SendMessage (IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
}
}

View file

@ -12,6 +12,21 @@
<AssemblyName>NBTExplorer</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
@ -38,7 +53,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>True</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\NBTExplorer.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
@ -55,7 +70,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<Optimize>True</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -69,25 +84,45 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Substrate">
<HintPath>..\References\Substrate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Substrate">
<HintPath>..\Substrate\SubstrateCS\bin\Release\NET2\Substrate.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FormRegistry.cs" />
<Compile Include="NbtClipboardController.cs" />
<Compile Include="Controllers\ExplorerBarController.cs" />
<Compile Include="Controllers\NodeTreeController.cs" />
<Compile Include="Controllers\RuleTreeController.cs" />
<Compile Include="Interop.cs" />
<Compile Include="Vendor\MultiSelectTreeView\MultiSelectTreeview.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Windows\CancelSearchForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\CancelSearchForm.Designer.cs">
<DependentUpon>CancelSearchForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\FindBlock.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\FindBlock.Designer.cs">
<DependentUpon>FindBlock.cs</DependentUpon>
</Compile>
<Compile Include="Windows\FindReplace.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\FindReplace.Designer.cs">
<DependentUpon>FindReplace.cs</DependentUpon>
</Compile>
<Compile Include="Windows\IconRegistry.cs" />
<Compile Include="Windows\MainForm.cs">
<SubType>Form</SubType>
@ -137,32 +172,6 @@
<Compile Include="Windows\EditHex.Designer.cs">
<DependentUpon>EditHex.cs</DependentUpon>
</Compile>
<Compile Include="Model\CompoundTagContainer.cs" />
<Compile Include="Model\CubicRegionDataNode.cs" />
<Compile Include="Model\CubicRegionFile.cs" />
<Compile Include="Model\DataNode.cs" />
<Compile Include="Model\DataNodeCollection.cs" />
<Compile Include="Model\DirectoryDataNode.cs" />
<Compile Include="Model\FileTypeRegistry.cs" />
<Compile Include="Model\ListTagContainer.cs" />
<Compile Include="Model\NbtFileDataNode.cs" />
<Compile Include="Model\NodeCapabilities.cs" />
<Compile Include="Model\RegionChunkDataNode.cs" />
<Compile Include="Model\RegionFileDataNode.cs" />
<Compile Include="Model\TagByteArrayDataNode.cs" />
<Compile Include="Model\TagByteDataNode.cs" />
<Compile Include="Model\TagCompoundDataNode.cs" />
<Compile Include="Model\TagContainerInterface.cs" />
<Compile Include="Model\TagDataNode.cs" />
<Compile Include="Model\TagDoubleDataNode.cs" />
<Compile Include="Model\TagFloatDataNode.cs" />
<Compile Include="Model\TagIntArrayDataNode.cs" />
<Compile Include="Model\TagIntDataNode.cs" />
<Compile Include="Model\TagListDataNode.cs" />
<Compile Include="Model\TagLongDataNode.cs" />
<Compile Include="Model\TagShortDataNode.cs" />
<Compile Include="Model\TagStringDataNode.cs" />
<Compile Include="NbtClipboardData.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
@ -171,7 +180,6 @@
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="SearchWorker.cs" />
<Compile Include="Model\TagKey.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\BuiltInContextMenu.cs">
<SubType>Component</SubType>
</Compile>
@ -195,9 +203,37 @@
<Compile Include="Windows\FormHandlers.cs" />
<Compile Include="Windows\NbtClipboardControllerWin.cs" />
<Compile Include="Windows\SearchStateWin.cs" />
<Compile Include="Windows\Search\WildcardRuleForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Search\WildcardRuleForm.Designer.cs">
<DependentUpon>WildcardRuleForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Search\StringRuleForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Search\StringRuleForm.Designer.cs">
<DependentUpon>StringRuleForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\Search\ValueRuleForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Search\ValueRuleForm.Designer.cs">
<DependentUpon>ValueRuleForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\ToolStripExplorerRenderer.cs" />
<Compile Include="Windows\WatermarkTextBox.cs">
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="Windows\CancelSearchForm.resx">
<DependentUpon>CancelSearchForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\FindBlock.resx">
<DependentUpon>FindBlock.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\FindReplace.resx">
<DependentUpon>FindReplace.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
@ -236,6 +272,15 @@
<EmbeddedResource Include="Vendor\Be.Windows.Forms.HexBox\HexBox.resx">
<DependentUpon>HexBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Search\WildcardRuleForm.resx">
<DependentUpon>WildcardRuleForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Search\StringRuleForm.resx">
<DependentUpon>StringRuleForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Search\ValueRuleForm.resx">
<DependentUpon>ValueRuleForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
@ -248,9 +293,27 @@
</None>
<None Include="Resources\arrow-090.png" />
<None Include="Resources\arrow-270.png" />
<Content Include="Windows\NBTExplorer.visualelementsmanifest.xml" />
<Content Include="Vendor\Be.Windows.Forms.HexBox\HexBox.bmp" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NBTModel\NBTModel.csproj">
<Project>{20d7cba3-5b6d-40b0-8d28-4c9a58e4ffbc}</Project>
<Name>NBTModel</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@ -259,4 +322,13 @@
<Target Name="AfterBuild">
</Target>
-->
<Target Name="AfterBuild">
<ItemGroup>
<Staging Include="$(OutputPath)\**\*.dll" />
<Staging Include="$(OutputPath)\**\*.exe" />
<Staging Include="$(OutputPath)\**\*.exe.config" />
<Staging Include="$(ProjectDir)\**\*.visualelementsmanifest.xml" />
</ItemGroup>
<Copy SourceFiles="@(Staging)" DestinationFolder="..\Staging\%(RecursiveDir)" />
</Target>
</Project>

146
NBTExplorer/Program.cs Normal file
View file

@ -0,0 +1,146 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using NBTExplorer.Windows;
namespace NBTExplorer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main (string[] args)
{
Application.ThreadException += AppThreadFailureHandler;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += AppDomainFailureHandler;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
public static void StaticInitFailure (Exception e)
{
Console.WriteLine("Static Initialization Failure:");
Exception original = e;
while (e != null) {
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
e = e.InnerException;
}
MessageBox.Show("Application failed during static initialization: " + original.Message);
Application.Exit();
}
private static void AppThreadFailureHandler (object sender, ThreadExceptionEventArgs e)
{
ProcessException(e.Exception);
}
private static void AppDomainFailureHandler (object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is Exception)
ProcessException(e.ExceptionObject as Exception);
else if (e.IsTerminating) {
MessageBox.Show("NBTExplorer encountered an unknown exception object: " + e.ExceptionObject.GetType().FullName,
"NBTExplorer failed to run", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
private static void ProcessException (Exception ex)
{
if (IsMissingSubstrate(ex)) {
MessageBox.Show("NBTExplorer could not find required assembly \"Substrate.dll\".\n\nIf you obtained NBTExplorer from a ZIP distribution, make sure you've extracted NBTExplorer and all of its supporting files into another directory before running it.",
"NBTExplorer failed to run", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
return;
}
if (IsMissingNBTModel(ex)) {
MessageBox.Show("NBTExplorer could not find required assembly \"NBTModel.dll\".\n\nIf you obtained NBTExplorer from a ZIP distribution, make sure you've extracted NBTExplorer and all of its supporting files into another directory before running it.",
"NBTExplorer failed to run", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
return;
}
StringBuilder errorText = new StringBuilder();
errorText.AppendLine("NBTExplorer encountered the following exception while trying to run: " + ex.GetType().Name);
errorText.AppendLine("Message: " + ex.Message);
Exception ix = ex;
while (ix.InnerException != null) {
ix = ix.InnerException;
errorText.AppendLine();
errorText.AppendLine("Caused by Inner Exception: " + ix.GetType().Name);
errorText.AppendLine("Message: " + ix.Message);
}
try {
string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NBTExplorer");
if (!Directory.Exists(logDir))
Directory.CreateDirectory(logDir);
string logPath = Path.Combine(logDir, "error.log");
using (var writer = new StreamWriter(logPath, true)) {
writer.WriteLine("NBTExplorer Error Report");
writer.WriteLine(DateTime.Now);
writer.WriteLine("-------");
writer.WriteLine(errorText);
writer.WriteLine("-------");
ix = ex;
while (ix != null) {
writer.WriteLine(ex.StackTrace);
writer.WriteLine("-------");
ix = ix.InnerException;
}
writer.WriteLine();
}
errorText.AppendLine();
errorText.AppendLine("Additional error detail has been written to:\n" + logPath);
}
catch { }
MessageBox.Show(errorText.ToString(), "NBTExplorer failed to run", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
private static bool IsMissingSubstrate (Exception ex)
{
if (ex is TypeInitializationException && ex.InnerException != null)
ex = ex.InnerException;
if (ex is FileNotFoundException) {
FileNotFoundException fileEx = ex as FileNotFoundException;
if (fileEx.FileName.Contains("Substrate"))
return true;
}
return false;
}
private static bool IsMissingNBTModel (Exception ex)
{
if (ex is TypeInitializationException && ex.InnerException != null)
ex = ex.InnerException;
if (ex is FileNotFoundException) {
FileNotFoundException fileEx = ex as FileNotFoundException;
if (fileEx.FileName.Contains("NBTModel"))
return true;
}
return false;
}
}
}

View file

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NBTExplorer")]
[assembly: AssemblyCopyright("Copyright © Justin Aquadro 2011-2012")]
[assembly: AssemblyCopyright("Copyright © Justin Aquadro 2011-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
[assembly: AssemblyVersion("2.8.0.0")]
[assembly: AssemblyFileVersion("2.8.0.0")]

View file

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 693 B

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 618 B

View file

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View file

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

View file

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

View file

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 621 B

View file

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

View file

Before

Width:  |  Height:  |  Size: 654 B

After

Width:  |  Height:  |  Size: 654 B

View file

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 508 B

View file

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 685 B

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

View file

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 677 B

View file

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View file

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View file

Before

Width:  |  Height:  |  Size: 624 B

After

Width:  |  Height:  |  Size: 624 B

View file

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 612 B

View file

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 593 B

View file

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

View file

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

View file

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

Some files were not shown because too many files have changed in this diff Show more