Compare commits

..

2 commits

Author SHA1 Message Date
Justin Aquadro
60f2689216 Update for more recent Xamarin stuff. Designate new mac development branch. 2014-03-24 01:06:42 -04:00
Justin Aquadro
6e679230c0 Prep for code-signing 2013-08-22 22:44:28 -04:00
285 changed files with 2714 additions and 14435 deletions

5
.gitignore vendored
View file

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

12
Entitlements.plist Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>$(TeamIdentifierPrefix)jaquadro.nbtexplorer</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)jaquadro.nbtexplorer</string>
</dict>
</plist>

View file

@ -2,7 +2,7 @@
using System.Collections.Generic;
using Substrate.Nbt;
namespace NBTModel.Interop
namespace NBTExplorer
{
public static class FormRegistry
{
@ -39,7 +39,6 @@ namespace NBTModel.Interop
}
public String Value { get; set; }
public bool AllowEmpty { get; set; }
}
public class RestrictedStringFormData : StringFormData

View file

@ -309,7 +309,7 @@ namespace NBTExplorer.Mac
imageFrame.X += 3;
imageFrame.Size = _image.Size;
if (ofView.MouseinRect(point, imageFrame))
if (ofView.IsMouseInRect(point, imageFrame))
return NSCellHit.ContentArea;
}

View file

@ -32,14 +32,6 @@ namespace NBTExplorer.Model
return null;
}
public TagNode GetTagNode (string name)
{
TagNode tag;
if (_tag.TryGetValue(name, out tag))
return tag;
return null;
}
public bool AddTag (TagNode tag, string name)
{
if (_tag.ContainsKey(name))
@ -69,18 +61,5 @@ namespace NBTExplorer.Model
return false;
}
public bool DeleteTag (string name)
{
if (!_tag.ContainsKey(name))
return false;
return DeleteTag(_tag[name]);
}
public bool ContainsTag (string name)
{
return _tag.ContainsKey(name);
}
}
}

View file

@ -1,7 +1,5 @@
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using NBTModel.Interop;
namespace NBTExplorer.Model
{
@ -32,8 +30,7 @@ namespace NBTExplorer.Model
{
get
{
return NodeCapabilities.Search
| NodeCapabilities.Refresh;
return NodeCapabilities.Search;
}
}
@ -42,16 +39,6 @@ namespace NBTExplorer.Model
get { return !IsExpanded; }
}
public override bool IsContainerType
{
get { return true; }
}
public override string NodePathName
{
get { return Path.GetFileName(_path); }
}
public override string NodeDisplay
{
get { return Path.GetFileName(_path); }
@ -84,14 +71,5 @@ namespace NBTExplorer.Model
_region = null;
Nodes.Clear();
}
public override bool RefreshNode ()
{
Dictionary<string, object> expandSet = BuildExpandSet(this);
Release();
RestoreExpandSet(this, expandSet);
return expandSet != null;
}
}
}

24
Model/CubicRegionFile.cs Normal file
View file

@ -0,0 +1,24 @@
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; }
}
}
}

215
Model/DataNode.cs Normal file
View file

@ -0,0 +1,215 @@
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,29 +1,17 @@
using System;
using System.Collections.Generic;
using NBTExplorer.Utility;
namespace NBTExplorer.Model
{
public class DataNodeCollection : IList<DataNode>
{
private SnapshotList<DataNode> _nodes;
private List<DataNode> _nodes;
private DataNode _parent;
private int _changeCount;
internal DataNodeCollection (DataNode parent)
{
_parent = parent;
_nodes = new SnapshotList<DataNode>();
}
public SnapshotState<DataNode> Snapshot ()
{
return _nodes.Snapshot();
}
public int ChangeCount
{
get { return _changeCount; }
_nodes = new List<DataNode>();
}
public int IndexOf (DataNode item)
@ -41,7 +29,6 @@ namespace NBTExplorer.Model
item.Parent = _parent;
_nodes.Insert(index, item);
_changeCount++;
}
public void RemoveAt (int index)
@ -53,7 +40,6 @@ namespace NBTExplorer.Model
node.Parent = null;
_nodes.RemoveAt(index);
_changeCount++;
}
DataNode IList<DataNode>.this[int index]
@ -71,7 +57,6 @@ namespace NBTExplorer.Model
_nodes[index].Parent = null;
_nodes[index] = value;
_nodes[index].Parent = _parent;
_changeCount++;
}
}
@ -85,7 +70,6 @@ namespace NBTExplorer.Model
item.Parent = _parent;
_nodes.Add(item);
_changeCount++;
}
public void Clear ()
@ -94,7 +78,6 @@ namespace NBTExplorer.Model
node.Parent = null;
_nodes.Clear();
_changeCount++;
}
public bool Contains (DataNode item)
@ -122,8 +105,6 @@ namespace NBTExplorer.Model
if (_nodes.Contains(item))
item.Parent = null;
_changeCount++;
return _nodes.Remove(item);
}

View file

@ -1,6 +1,4 @@
using System.IO;
using System.Collections.Generic;
using System;
namespace NBTExplorer.Model
{
@ -17,26 +15,7 @@ namespace NBTExplorer.Model
{
get
{
return NodeCapabilities.Search
| NodeCapabilities.Refresh;
}
}
public string NodeDirPath
{
get { return _path; }
}
public override string NodePathName
{
get
{
string path = (_path.EndsWith("/") || _path.EndsWith("\\")) ? _path : _path + '/';
string name = Path.GetDirectoryName(path) ?? path.Substring(0, path.Length - 1);
int sepIndex = Math.Max(name.LastIndexOf('/'), name.LastIndexOf('\\'));
return (sepIndex > 0) ? name.Substring(sepIndex + 1) : name;
return NodeCapabilities.Search;
}
}
@ -50,11 +29,6 @@ namespace NBTExplorer.Model
get { return !IsExpanded; }
}
public override bool IsContainerType
{
get { return true; }
}
protected override void ExpandCore ()
{
foreach (string dirpath in Directory.GetDirectories(_path)) {
@ -77,14 +51,5 @@ namespace NBTExplorer.Model
{
Nodes.Clear();
}
public override bool RefreshNode ()
{
Dictionary<string, object> expandSet = BuildExpandSet(this);
Release();
RestoreExpandSet(this, expandSet);
return expandSet != null;
}
}
}

38
Model/ListTagContainer.cs Normal file
View file

@ -0,0 +1,38 @@
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;
}
}
}

141
Model/NbtFileDataNode.cs Normal file
View file

@ -0,0 +1,141 @@
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);
}
}
}

19
Model/NodeCapabilities.cs Normal file
View file

@ -0,0 +1,19 @@
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

@ -21,29 +21,13 @@ namespace NBTExplorer.Model
_container = new CompoundTagContainer(new TagNodeCompound());
}
public int X
{
get { return _x; }
}
public int Z
{
get { return _z; }
}
protected RegionFileDataNode RegionParent
{
get { return Parent as RegionFileDataNode; }
}
protected override NodeCapabilities Capabilities
{
get
{
return NodeCapabilities.CreateTag
| NodeCapabilities.PasteInto
| NodeCapabilities.Search
| NodeCapabilities.Delete;
| NodeCapabilities.Search;
}
}
@ -52,22 +36,9 @@ namespace NBTExplorer.Model
get { return !IsExpanded; }
}
public override string NodePathName
{
get { return _x + "." + _z; }
}
public override string NodeDisplay
{
get
{
RegionKey key = _regionFile.parseCoordinatesFromName();
string absChunk = "";
if (key != RegionKey.InvalidRegion)
absChunk = " in world at (" + (key.X * 32 + _x) + ", " + (key.Z * 32 + _z) + ")";
return "Chunk [" + _x + ", " + _z + "]" + absChunk;
}
get { return "Chunk [" + _x + ", " + _z + "]"; }
}
protected override void ExpandCore ()
@ -100,22 +71,6 @@ namespace NBTExplorer.Model
}
}
public override bool IsContainerType
{
get { return true; }
}
public override bool DeleteNode ()
{
if (CanDeleteNode && _regionFile.HasChunk(_x, _z)) {
RegionParent.QueueDeleteChunk(_x, _z);
IsParentModified = true;
return Parent.Nodes.Remove(this);
}
return false;
}
public bool IsNamedContainer
{
get { return true; }

View file

@ -1,9 +1,6 @@
using System.IO;
using System.Text.RegularExpressions;
using Substrate.Core;
using System.Collections.Generic;
using NBTModel.Interop;
using System;
namespace NBTExplorer.Model
{
@ -11,9 +8,8 @@ namespace NBTExplorer.Model
{
private string _path;
private RegionFile _region;
private List<RegionKey> _deleteQueue = new List<RegionKey>();
private static Regex _namePattern = new Regex(@"^r\.(-?\d+)\.(-?\d+)\.(mcr|mca)$");
private static Regex _namePattern = new Regex(@"^r(\.-?\d+){2}\.(mcr|mca)$");
private RegionFileDataNode (string path)
{
@ -31,26 +27,11 @@ namespace NBTExplorer.Model
return _namePattern.IsMatch(path);
}
public static bool RegionCoordinates (string path, out int rx, out int rz)
{
rx = 0;
rz = 0;
Match match = _namePattern.Match(path);
if (match.Success && match.Groups.Count > 3) {
rx = int.Parse(match.Groups[1].Value);
rz = int.Parse(match.Groups[2].Value);
}
return match.Success;
}
protected override NodeCapabilities Capabilities
{
get
{
return NodeCapabilities.Search
| NodeCapabilities.Refresh;
return NodeCapabilities.Search;
}
}
@ -59,16 +40,6 @@ namespace NBTExplorer.Model
get { return !IsExpanded; }
}
public override bool IsContainerType
{
get { return true; }
}
public override string NodePathName
{
get { return Path.GetFileName(_path); }
}
public override string NodeDisplay
{
get { return Path.GetFileName(_path); }
@ -88,7 +59,7 @@ namespace NBTExplorer.Model
}
}
}
catch (Exception e) {
catch {
if (FormRegistry.MessageBox != null)
FormRegistry.MessageBox("Not a valid region file.");
}
@ -101,31 +72,5 @@ namespace NBTExplorer.Model
_region = null;
Nodes.Clear();
}
protected override void SaveCore ()
{
foreach (RegionKey key in _deleteQueue) {
if (_region.HasChunk(key.X, key.Z))
_region.DeleteChunk(key.X, key.Z);
}
_deleteQueue.Clear();
}
public override bool RefreshNode ()
{
Dictionary<string, object> expandSet = BuildExpandSet(this);
Release();
RestoreExpandSet(this, expandSet);
return expandSet != null;
}
public void QueueDeleteChunk (int rx, int rz)
{
RegionKey key = new RegionKey(rx, rz);
if (!_deleteQueue.Contains(key))
_deleteQueue.Add(key);
}
}
}

View file

@ -16,11 +16,7 @@ namespace NBTExplorer.Model
public override bool CanEditNode
{
#if WINDOWS
get { return true; }
#else
get { return false; }
#endif
get { return !IsMono(); }
}
public override bool EditNode ()
@ -32,5 +28,10 @@ namespace NBTExplorer.Model
{
get { return NodeDisplayPrefix + Tag.Data.Length + " bytes"; }
}
private bool IsMono ()
{
return Type.GetType("Mono.Runtime") != null;
}
}
}

View file

@ -13,18 +13,6 @@ namespace NBTExplorer.Model
get { return base.Tag as TagNodeByte; }
}
public override bool Parse (string value)
{
byte data;
if (!byte.TryParse(value, out data))
return false;
Tag.Data = data;
IsDataModified = true;
return true;
}
public override bool EditNode ()
{
return EditScalarValue(Tag);

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using NBTModel.Interop;
using Substrate.Nbt;
namespace NBTExplorer.Model
@ -101,40 +100,10 @@ namespace NBTExplorer.Model
return _container.DeleteTag(tag);
}
public bool ContainsTag (string name)
{
return _container.ContainsTag(name);
}
public override void SyncTag ()
{
Dictionary<TagNode, TagDataNode> lookup = new Dictionary<TagNode, TagDataNode>();
foreach (TagDataNode node in Nodes)
lookup[node.Tag] = node;
foreach (var kvp in lookup) {
if (!Tag.Values.Contains(kvp.Key))
Nodes.Remove(kvp.Value);
}
foreach (TagNode tag in Tag.Values) {
if (!lookup.ContainsKey(tag)) {
TagDataNode newnode = TagDataNode.CreateFromTag(tag);
if (newnode != null) {
Nodes.Add(newnode);
newnode.Expand();
}
}
}
foreach (TagDataNode node in Nodes)
node.SyncTag();
}
private void AddTag (TagNode tag, string name)
{
_container.AddTag(tag, name);
IsDataModified = true;
IsModified = true;
if (IsExpanded) {
TagDataNode node = TagDataNode.CreateFromTag(tag);

View file

@ -24,18 +24,13 @@ namespace NBTExplorer.Model
IEnumerable<string> TagNamesInUse { get; }
string GetTagName (TagNode tag);
TagNode GetTagNode (string name);
bool AddTag (TagNode tag, string name);
bool RenameTag (TagNode tag, string name);
bool ContainsTag (string name);
bool DeleteTag (string name);
}
public interface IOrderedTagContainer : ITagContainer
{
int GetTagIndex (TagNode tag);
bool InsertTag (TagNode tag, int index);
bool AppendTag (TagNode tag);
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using NBTModel.Interop;
using Substrate.Nbt;
namespace NBTExplorer.Model
@ -45,9 +44,6 @@ namespace NBTExplorer.Model
return false;
}
public virtual void Clear ()
{ }
#endregion
protected override NodeCapabilities Capabilities
@ -59,8 +55,8 @@ namespace NBTExplorer.Model
| NodeCapabilities.Cut
| NodeCapabilities.Delete
| NodeCapabilities.PasteInto
| ((TagParent != null && TagParent.IsNamedContainer) ? NodeCapabilities.Rename : NodeCapabilities.None)
| ((TagParent != null && TagParent.IsOrderedContainer) ? NodeCapabilities.Reorder : NodeCapabilities.None)
| (TagParent.IsNamedContainer ? NodeCapabilities.Rename : NodeCapabilities.None)
| (TagParent.IsOrderedContainer ? NodeCapabilities.Reorder : NodeCapabilities.None)
| NodeCapabilities.Search;
}
}
@ -70,11 +66,6 @@ namespace NBTExplorer.Model
get { return !IsExpanded && TagCount > 0; }
}
public override bool IsContainerType
{
get { return true; }
}
public override string NodeDisplay
{
get { return NodeDisplayPrefix + TagCount + ((TagCount == 1) ? " entry" : " entries"); }
@ -95,9 +86,7 @@ namespace NBTExplorer.Model
_tagRegistry[TagType.TAG_INT_ARRAY] = typeof(TagIntArrayDataNode);
_tagRegistry[TagType.TAG_LIST] = typeof(TagListDataNode);
_tagRegistry[TagType.TAG_LONG] = typeof(TagLongDataNode);
_tagRegistry[TagType.TAG_LONG_ARRAY] = typeof(TagLongArrayDataNode);
_tagRegistry[TagType.TAG_SHORT] = typeof(TagShortDataNode);
_tagRegistry[TagType.TAG_SHORT_ARRAY] = typeof(TagShortArrayDataNode);
_tagRegistry[TagType.TAG_STRING] = typeof(TagStringDataNode);
}
@ -130,12 +119,8 @@ namespace NBTExplorer.Model
return new TagNodeList(TagType.TAG_BYTE);
case TagType.TAG_LONG:
return new TagNodeLong(0);
case TagType.TAG_LONG_ARRAY:
return new TagNodeLongArray(new long[0]);
case TagType.TAG_SHORT:
return new TagNodeShort(0);
case TagType.TAG_SHORT_ARRAY:
return new TagNodeShortArray(new short[0]);
case TagType.TAG_STRING:
return new TagNodeString("");
default:
@ -155,21 +140,16 @@ namespace NBTExplorer.Model
get { return base.Parent as IMetaTagContainer; }
}
public TagNode Tag
protected TagNode Tag
{
get { return _tag; }
protected set
set
{
if (_tag.GetTagType() == value.GetTagType())
_tag = value;
}
}
public virtual bool Parse (string value)
{
return false;
}
protected override NodeCapabilities Capabilities
{
get
@ -178,8 +158,8 @@ namespace NBTExplorer.Model
| NodeCapabilities.Cut
| NodeCapabilities.Delete
| NodeCapabilities.Edit
| ((TagParent != null && TagParent.IsNamedContainer) ? NodeCapabilities.Rename : NodeCapabilities.None)
| ((TagParent != null && TagParent.IsOrderedContainer) ? NodeCapabilities.Reorder : NodeCapabilities.None);
| (TagParent.IsNamedContainer ? NodeCapabilities.Rename : NodeCapabilities.None)
| (TagParent.IsOrderedContainer ? NodeCapabilities.Reorder : NodeCapabilities.None);
}
}
@ -187,7 +167,7 @@ namespace NBTExplorer.Model
{
get
{
if (TagParent != null && TagParent.IsOrderedContainer)
if (TagParent.IsOrderedContainer)
return TagParent.OrderedTagContainer.GetTagIndex(Tag) > 0;
return false;
}
@ -197,7 +177,7 @@ namespace NBTExplorer.Model
{
get
{
if (TagParent != null && TagParent.IsOrderedContainer)
if (TagParent.IsOrderedContainer)
return TagParent.OrderedTagContainer.GetTagIndex(Tag) < (TagParent.TagCount - 1);
return false;
}
@ -214,20 +194,6 @@ namespace NBTExplorer.Model
}
}
public override string NodePathName
{
get
{
if (Parent is TagDataNode.Container) {
TagDataNode.Container container = Parent as TagDataNode.Container;
if (container.IsOrderedContainer)
return container.OrderedTagContainer.GetTagIndex(Tag).ToString();
}
return base.NodePathName;
}
}
protected string NodeDisplayPrefix
{
get
@ -244,9 +210,8 @@ namespace NBTExplorer.Model
public override bool DeleteNode ()
{
if (CanDeleteNode && TagParent != null) {
if (CanDeleteNode) {
TagParent.DeleteTag(Tag);
IsParentModified = true;
return Parent.Nodes.Remove(this);
}
@ -255,13 +220,13 @@ namespace NBTExplorer.Model
public override bool RenameNode ()
{
if (CanRenameNode && TagParent != null && TagParent.IsNamedContainer && FormRegistry.EditString != null) {
if (CanRenameNode && TagParent.IsNamedContainer && FormRegistry.EditString != null) {
RestrictedStringFormData data = new RestrictedStringFormData(TagParent.NamedTagContainer.GetTagName(Tag));
data.RestrictedValues.AddRange(TagParent.NamedTagContainer.TagNamesInUse);
if (FormRegistry.RenameTag(data)) {
if (TagParent.NamedTagContainer.RenameTag(Tag, data.Value)) {
IsDataModified = true;
IsModified = true;
return true;
}
}
@ -282,11 +247,10 @@ namespace NBTExplorer.Model
public override bool CutNode ()
{
if (CanCutNode && TagParent != null) {
if (CanCutNode) {
NbtClipboardController.CopyToClipboard(new NbtClipboardData(NodeName, Tag));
TagParent.DeleteTag(Tag);
IsParentModified = true;
Parent.Nodes.Remove(this);
return true;
}
@ -296,7 +260,7 @@ namespace NBTExplorer.Model
public override bool ChangeRelativePosition (int offset)
{
if (CanReoderNode && TagParent != null) {
if (CanReoderNode) {
int curIndex = TagParent.OrderedTagContainer.GetTagIndex(Tag);
int newIndex = curIndex + offset;
@ -309,7 +273,7 @@ namespace NBTExplorer.Model
DataNode parent = Parent;
parent.Nodes.Remove(this);
parent.Nodes.Insert(newIndex, this);
IsParentModified = true;
parent.IsModified = true;
return true;
}
@ -320,7 +284,7 @@ namespace NBTExplorer.Model
{
if (FormRegistry.EditTagScalar != null) {
if (FormRegistry.EditTagScalar(new TagScalarFormData(tag))) {
IsDataModified = true;
IsModified = true;
return true;
}
}
@ -333,7 +297,7 @@ namespace NBTExplorer.Model
StringFormData data = new StringFormData(tag.ToTagString().Data);
if (FormRegistry.EditString(data)) {
tag.ToTagString().Data = data.Value;
IsDataModified = true;
IsModified = true;
return true;
}
}
@ -353,39 +317,8 @@ namespace NBTExplorer.Model
};
if (FormRegistry.EditByteArray(data)) {
tag.ToTagByteArray().Data = data.Data;
//Array.Copy(data.Data, tag.ToTagByteArray().Data, tag.ToTagByteArray().Length);
IsDataModified = true;
return true;
}
}
return false;
}
protected bool EditShortHexValue (TagNode tag)
{
if (FormRegistry.EditByteArray != null) {
TagNodeShortArray iatag = tag.ToTagShortArray();
byte[] byteData = new byte[iatag.Length * 2];
for (int i = 0; i < iatag.Length; i++) {
byte[] buf = BitConverter.GetBytes(iatag.Data[i]);
Array.Copy(buf, 0, byteData, 2 * i, 2);
}
ByteArrayFormData data = new ByteArrayFormData() {
NodeName = NodeName,
BytesPerElement = 2,
Data = byteData,
};
if (FormRegistry.EditByteArray(data)) {
iatag.Data = new short[data.Data.Length / 2];
for (int i = 0; i < iatag.Length; i++) {
iatag.Data[i] = BitConverter.ToInt16(data.Data, i * 2);
}
IsDataModified = true;
Array.Copy(data.Data, tag.ToTagByteArray().Data, tag.ToTagByteArray().Length);
IsModified = true;
return true;
}
}
@ -410,56 +343,16 @@ namespace NBTExplorer.Model
};
if (FormRegistry.EditByteArray(data)) {
iatag.Data = new int[data.Data.Length / 4];
for (int i = 0; i < iatag.Length; i++) {
iatag.Data[i] = BitConverter.ToInt32(data.Data, i * 4);
}
IsDataModified = true;
IsModified = true;
return true;
}
}
return false;
}
protected bool EditLongHexValue(TagNode tag)
{
if (FormRegistry.EditByteArray != null)
{
TagNodeLongArray latag = tag.ToTagLongArray();
byte[] byteData = new byte[latag.Length * 8];
for (int i = 0; i < latag.Length; i++)
{
byte[] buf = BitConverter.GetBytes(latag.Data[i]);
Array.Copy(buf, 0, byteData, 8 * i, 8);
}
ByteArrayFormData data = new ByteArrayFormData()
{
NodeName = NodeName,
BytesPerElement = 8,
Data = byteData,
};
if (FormRegistry.EditByteArray(data))
{
latag.Data = new long[data.Data.Length / 8];
for (int i = 0; i < latag.Length; i++)
{
latag.Data[i] = BitConverter.ToInt64(data.Data, i * 8);
}
IsDataModified = true;
return true;
}
}
return false;
}
public virtual void SyncTag ()
{
}
}
}

View file

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

16
Model/TagFloatDataNode.cs Normal file
View file

@ -0,0 +1,16 @@
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

@ -16,11 +16,7 @@ namespace NBTExplorer.Model
public override bool CanEditNode
{
#if WINDOWS
get { return true; }
#else
get { return false; }
#endif
get { return !IsMono(); }
}
public override bool EditNode ()
@ -32,5 +28,10 @@ namespace NBTExplorer.Model
{
get { return NodeDisplayPrefix + Tag.Data.Length + " integers"; }
}
private bool IsMono ()
{
return Type.GetType("Mono.Runtime") != null;
}
}
}

16
Model/TagIntDataNode.cs Normal file
View file

@ -0,0 +1,16 @@
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

@ -22,7 +22,7 @@ namespace NBTExplorer.Model
if (typeDiff != 0)
return typeDiff;
return String.Compare(x.Name, y.Name, false);
return String.Compare(x.Name, y.Name, true);
}
#endregion

View file

@ -1,5 +1,4 @@
using System;
using NBTModel.Interop;
using Substrate.Nbt;
namespace NBTExplorer.Model
@ -11,10 +10,10 @@ namespace NBTExplorer.Model
public TagListDataNode (TagNodeList tag)
: base(tag)
{
_container = new ListTagContainer(tag, res => IsDataModified = true);
_container = new ListTagContainer(tag);
}
public new TagNodeList Tag
protected new TagNodeList Tag
{
get { return base.Tag as TagNodeList; }
set { base.Tag = value; }
@ -46,7 +45,7 @@ namespace NBTExplorer.Model
if (data == null)
return false;
if (data.Node != null && (data.Node.GetTagType() == Tag.ValueType || Tag.Count == 0))
if (data.Node != null && data.Node.GetTagType() == Tag.ValueType)
return true;
}
@ -76,10 +75,6 @@ namespace NBTExplorer.Model
if (clipboard == null || clipboard.Node == null)
return false;
if (Tag.Count == 0) {
Tag.ChangeValueType(clipboard.Node.GetTagType());
}
AppendTag(clipboard.Node);
return true;
}
@ -104,32 +99,16 @@ namespace NBTExplorer.Model
return _container.DeleteTag(tag);
}
public override void Clear ()
private void AppendTag (TagNode tag)
{
if (TagCount == 0)
return;
Nodes.Clear();
Tag.Clear();
IsDataModified = true;
}
public bool AppendTag (TagNode tag)
{
if (tag == null || !CanCreateTag(tag.GetTagType()))
return false;
_container.InsertTag(tag, _container.TagCount);
IsDataModified = true;
IsModified = true;
if (IsExpanded) {
TagDataNode node = TagDataNode.CreateFromTag(tag);
if (node != null)
Nodes.Add(node);
}
return true;
}
}
}

16
Model/TagLongDataNode.cs Normal file
View file

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

16
Model/TagShortDataNode.cs Normal file
View file

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

View file

@ -8,19 +8,6 @@ namespace NBTExplorer.Model
: base(tag)
{ }
protected new TagNodeString Tag
{
get { return base.Tag as TagNodeString; }
}
public override bool Parse (string value)
{
Tag.Data = value;
IsDataModified = true;
return true;
}
public override bool EditNode ()
{
return EditStringValue(Tag);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

View file

@ -1,54 +0,0 @@
<?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

@ -1,98 +0,0 @@
<?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

@ -12,21 +12,6 @@
<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>
@ -53,7 +38,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>True</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Debug\NBTExplorer.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
@ -70,7 +55,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<Optimize>True</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -84,45 +69,25 @@
<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="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="FormRegistry.cs" />
<Compile Include="NbtClipboardController.cs" />
<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>
@ -172,6 +137,32 @@
<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">
@ -180,6 +171,7 @@
<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>
@ -203,37 +195,9 @@
<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>
@ -272,15 +236,6 @@
<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>
@ -293,27 +248,9 @@
</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>
<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>
<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.
@ -322,13 +259,4 @@
<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>

View file

@ -1,123 +1,54 @@

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

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

View file

@ -1,106 +0,0 @@
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

@ -1,438 +0,0 @@
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();
}
}
}

View file

@ -1,60 +0,0 @@
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

@ -1,146 +0,0 @@
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;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

View file

@ -1,211 +0,0 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using NBTExplorer.Model;
namespace NBTExplorer
{
internal interface ISearchState
{
DataNode RootNode { get; set; }
IEnumerator<DataNode> State { get; set; }
bool TerminateOnDiscover { get; set; }
bool IsTerminated { get; set; }
float ProgressRate { get; set; }
void InvokeDiscoverCallback (DataNode node);
void InvokeProgressCallback (DataNode node);
void InvokeCollapseCallback (DataNode node);
void InvokeEndCallback (DataNode node);
bool TestNode (DataNode node);
}
internal abstract class NameValueSearchState : ISearchState
{
public virtual string SearchName { get; set; }
public virtual string SearchValue { get; set; }
public DataNode RootNode { get; set; }
public IEnumerator<DataNode> State { get; set; }
public bool TerminateOnDiscover { get; set; }
public bool IsTerminated { get; set; }
public float ProgressRate { get; set; }
public abstract void InvokeDiscoverCallback (DataNode node);
public abstract void InvokeProgressCallback (DataNode node);
public abstract void InvokeCollapseCallback (DataNode node);
public abstract void InvokeEndCallback (DataNode node);
protected NameValueSearchState ()
{
TerminateOnDiscover = true;
ProgressRate = .5f;
}
public bool TestNode (DataNode node)
{
bool mName = SearchName == null;
bool mValue = SearchValue == null;
if (SearchName != null) {
string tagName = node.NodeName;
if (tagName != null)
mName = CultureInfo.InvariantCulture.CompareInfo.IndexOf(tagName, SearchName, CompareOptions.IgnoreCase) >= 0;
}
if (SearchValue != null) {
string tagValue = node.NodeDisplay;
if (tagValue != null)
mValue = CultureInfo.InvariantCulture.CompareInfo.IndexOf(tagValue, SearchValue, CompareOptions.IgnoreCase) >= 0;
}
if (mName && mValue) {
return true;
}
return false;
}
}
internal class SearchWorker
{
private ISearchState _state;
private bool _cancel;
private object _lock;
private Stopwatch _progressWatch;
private float _progressTime;
private float _lastSampleTime;
public SearchWorker (ISearchState state)
{
_state = state;
_lock = new object();
}
public void Cancel ()
{
lock (_lock) {
_cancel = true;
}
}
public void Run ()
{
_progressWatch = new Stopwatch();
_progressWatch.Start();
if (_state.State == null)
_state.State = FindNode(_state.RootNode).GetEnumerator();
if (!_state.State.MoveNext())
InvokeEndCallback();
_progressWatch.Stop();
}
private IEnumerable<DataNode> FindNode (DataNode node)
{
lock (_lock) {
if (_cancel)
yield break;
}
if (node == null)
yield break;
bool searchExpanded = false;
if (!node.IsExpanded) {
node.Expand();
searchExpanded = true;
}
TagDataNode tagNode = node as TagDataNode;
if (tagNode != null) {
float currentSampleTime = (float)_progressWatch.Elapsed.TotalSeconds;
_progressTime += (currentSampleTime - _lastSampleTime);
_lastSampleTime = currentSampleTime;
if (_progressTime > _state.ProgressRate) {
InvokeProgressCallback(node);
_progressTime -= _state.ProgressRate;
}
if (_state.TestNode(tagNode)) {
InvokeDiscoverCallback(node);
if (_state.TerminateOnDiscover)
yield return node;
}
/*bool mName = _state.SearchName == null;
bool mValue = _state.SearchValue == null;
if (_state.SearchName != null) {
string tagName = node.NodeName;
if (tagName != null)
mName = tagName.Contains(_state.SearchName);
}
if (_state.SearchValue != null) {
string tagValue = node.NodeDisplay;
if (tagValue != null)
mValue = tagValue.Contains(_state.SearchValue);
}
if (mName && mValue) {
InvokeDiscoverCallback(node);
yield return node;
}*/
}
using (node.Nodes.Snapshot()) {
foreach (DataNode sub in node.Nodes) {
foreach (DataNode s in FindNode(sub))
yield return s;
}
}
/*IList<DataNode> nodeList = node.Nodes;
for (int i = 0; i < nodeList.Count; i++) {
int changeset = node.Nodes.ChangeCount;
foreach (DataNode s in FindNode(nodeList[i])) {
}
}
foreach (DataNode sub in node.Nodes) {
foreach (DataNode s in FindNode(sub))
yield return s;
}*/
if (searchExpanded) {
if (!node.IsModified) {
node.Collapse();
InvokeCollapseCallback(node);
}
}
}
private void InvokeProgressCallback (DataNode node)
{
_state.InvokeProgressCallback(node);
}
private void InvokeDiscoverCallback (DataNode node)
{
_state.InvokeDiscoverCallback(node);
}
private void InvokeCollapseCallback (DataNode node)
{
_state.InvokeCollapseCallback(node);
}
private void InvokeEndCallback ()
{
_state.IsTerminated = true;
_state.InvokeEndCallback(null);
}
}
}

View file

@ -1,630 +0,0 @@
// Copyright 2007 Andrew D. Weiss
// Licensed under CPOL
// http://www.codeproject.com/Articles/20581/Multiselect-Treeview-Implementation
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace NBTExplorer.Vendor.MultiSelectTreeView
{
public class MultiSelectTreeView : TreeView
{
#region Selected Node(s) Properties
private List<TreeNode> m_SelectedNodes = null;
public List<TreeNode> SelectedNodes
{
get
{
return m_SelectedNodes;
}
set
{
BeginUpdate();
ClearSelectedNodes();
if( value != null )
{
foreach( TreeNode node in value )
{
ToggleNode( node, true );
}
}
EndUpdate();
}
}
// Note we use the new keyword to Hide the native treeview's SelectedNode property.
private TreeNode m_SelectedNode;
public new TreeNode SelectedNode
{
get { return m_SelectedNode; }
set
{
ClearSelectedNodes();
if( value != null )
{
SelectNode( value );
}
}
}
#endregion
public MultiSelectTreeView()
{
DoubleBuffered = true;
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
m_SelectedNodes = new List<TreeNode>();
base.SelectedNode = null;
}
private void UpdateExtendedStyles ()
{
if (Interop.WinInteropAvailable) {
int style = 0;
if (DoubleBuffered)
style |= NativeInterop.TVS_EX_DOUBLEBUFFER;
if (style != 0)
Interop.SendMessage(Handle, NativeInterop.TVM_SETEXTENDEDSTYLE, (IntPtr)NativeInterop.TVS_EX_DOUBLEBUFFER, (IntPtr)style);
}
}
#region Overridden Events
protected override void OnHandleCreated (EventArgs e)
{
base.OnHandleCreated(e);
if (Interop.WinInteropAvailable) {
UpdateExtendedStyles();
if (!Interop.IsWinXP)
Interop.SendMessage(Handle, NativeInterop.TVM_SETBKCOLOR, IntPtr.Zero, (IntPtr)ColorTranslator.ToWin32(BackColor));
}
}
protected override void OnGotFocus( EventArgs e )
{
// Make sure at least one node has a selection
// this way we can tab to the ctrl and use the
// keyboard to select nodes
try
{
if( m_SelectedNode == null && this.TopNode != null )
{
ToggleNode( this.TopNode, true );
}
base.OnGotFocus( e );
}
catch( Exception ex )
{
HandleException( ex );
}
}
protected override void OnMouseDown( MouseEventArgs e )
{
// If the user clicks on a node that was not
// previously selected, select it now.
try
{
base.SelectedNode = null;
TreeNode node = this.GetNodeAt( e.Location );
if( node != null )
{
int leftBound = node.Bounds.X; // - 20; // Allow user to click on image
if (node.TreeView.ImageList != null)
leftBound -= 20;
int rightBound = node.Bounds.Right + 10; // Give a little extra room
if( e.Location.X > leftBound && e.Location.X < rightBound )
{
if( ModifierKeys == Keys.None && ( m_SelectedNodes.Contains( node ) ) )
{
// Potential Drag Operation
// Let Mouse Up do select
}
else
{
SelectNode( node );
}
}
}
base.OnMouseDown( e );
}
catch( Exception ex )
{
HandleException( ex );
}
}
protected override void OnMouseUp( MouseEventArgs e )
{
// If the clicked on a node that WAS previously
// selected then, reselect it now. This will clear
// any other selected nodes. e.g. A B C D are selected
// the user clicks on B, now A C & D are no longer selected.
try
{
// Check to see if a node was clicked on
TreeNode node = this.GetNodeAt( e.Location );
if( node != null )
{
if( ModifierKeys == Keys.None && m_SelectedNodes.Contains( node ) )
{
int leftBound = node.Bounds.X; // -20; // Allow user to click on image
int rightBound = node.Bounds.Right + 10; // Give a little extra room
if( e.Location.X > leftBound && e.Location.X < rightBound )
{
SelectNode( node );
}
}
}
base.OnMouseUp( e );
}
catch( Exception ex )
{
HandleException( ex );
}
}
protected override void OnItemDrag( ItemDragEventArgs e )
{
// If the user drags a node and the node being dragged is NOT
// selected, then clear the active selection, select the
// node being dragged and drag it. Otherwise if the node being
// dragged is selected, drag the entire selection.
try
{
TreeNode node = e.Item as TreeNode;
if( node != null )
{
if( !m_SelectedNodes.Contains( node ) )
{
SelectSingleNode( node );
ToggleNode( node, true );
}
}
base.OnItemDrag( e );
}
catch( Exception ex )
{
HandleException( ex );
}
}
protected override void OnBeforeSelect( TreeViewCancelEventArgs e )
{
// Never allow base.SelectedNode to be set!
try
{
base.SelectedNode = null;
e.Cancel = true;
base.OnBeforeSelect( e );
}
catch( Exception ex )
{
HandleException( ex );
}
}
protected override void OnAfterSelect( TreeViewEventArgs e )
{
// Never allow base.SelectedNode to be set!
try
{
base.OnAfterSelect( e );
base.SelectedNode = null;
}
catch( Exception ex )
{
HandleException( ex );
}
}
protected override void OnKeyDown( KeyEventArgs e )
{
// Handle all possible key strokes for the control.
// including navigation, selection, etc.
base.OnKeyDown( e );
if( e.KeyCode == Keys.ShiftKey ) return;
//this.BeginUpdate();
bool bShift = ( ModifierKeys == Keys.Shift );
try
{
// Nothing is selected in the tree, this isn't a good state
// select the top node
if( m_SelectedNode == null && this.TopNode != null )
{
ToggleNode( this.TopNode, true );
}
// Nothing is still selected in the tree, this isn't a good state, leave.
if( m_SelectedNode == null ) return;
if( e.KeyCode == Keys.Left )
{
if( m_SelectedNode.IsExpanded && m_SelectedNode.Nodes.Count > 0 )
{
// Collapse an expanded node that has children
m_SelectedNode.Collapse();
}
else if( m_SelectedNode.Parent != null )
{
// Node is already collapsed, try to select its parent.
SelectSingleNode( m_SelectedNode.Parent );
}
}
else if( e.KeyCode == Keys.Right )
{
if( !m_SelectedNode.IsExpanded )
{
// Expand a collpased node's children
m_SelectedNode.Expand();
}
else
{
// Node was already expanded, select the first child
SelectSingleNode( m_SelectedNode.FirstNode );
}
}
else if( e.KeyCode == Keys.Up )
{
// Select the previous node
if( m_SelectedNode.PrevVisibleNode != null )
{
SelectNode( m_SelectedNode.PrevVisibleNode );
}
}
else if( e.KeyCode == Keys.Down )
{
// Select the next node
if( m_SelectedNode.NextVisibleNode != null )
{
SelectNode( m_SelectedNode.NextVisibleNode );
}
}
else if( e.KeyCode == Keys.Home )
{
if( bShift )
{
if( m_SelectedNode.Parent == null )
{
// Select all of the root nodes up to this point
if( this.Nodes.Count > 0 )
{
SelectNode( this.Nodes[0] );
}
}
else
{
// Select all of the nodes up to this point under this nodes parent
SelectNode( m_SelectedNode.Parent.FirstNode );
}
}
else
{
// Select this first node in the tree
if( this.Nodes.Count > 0 )
{
SelectSingleNode( this.Nodes[0] );
}
}
}
else if( e.KeyCode == Keys.End )
{
if( bShift )
{
if( m_SelectedNode.Parent == null )
{
// Select the last ROOT node in the tree
if( this.Nodes.Count > 0 )
{
SelectNode( this.Nodes[this.Nodes.Count - 1] );
}
}
else
{
// Select the last node in this branch
SelectNode( m_SelectedNode.Parent.LastNode );
}
}
else
{
if( this.Nodes.Count > 0 )
{
// Select the last node visible node in the tree.
// Don't expand branches incase the tree is virtual
TreeNode ndLast = this.Nodes[0].LastNode;
while( ndLast.IsExpanded && ( ndLast.LastNode != null ) )
{
ndLast = ndLast.LastNode;
}
SelectSingleNode( ndLast );
}
}
}
else if( e.KeyCode == Keys.PageUp )
{
// Select the highest node in the display
int nCount = this.VisibleCount;
TreeNode ndCurrent = m_SelectedNode;
while( ( nCount ) > 0 && ( ndCurrent.PrevVisibleNode != null ) )
{
ndCurrent = ndCurrent.PrevVisibleNode;
nCount--;
}
SelectSingleNode( ndCurrent );
}
else if( e.KeyCode == Keys.PageDown )
{
// Select the lowest node in the display
int nCount = this.VisibleCount;
TreeNode ndCurrent = m_SelectedNode;
while( ( nCount ) > 0 && ( ndCurrent.NextVisibleNode != null ) )
{
ndCurrent = ndCurrent.NextVisibleNode;
nCount--;
}
SelectSingleNode( ndCurrent );
}
else
{
// Assume this is a search character a-z, A-Z, 0-9, etc.
// Select the first node after the current node that
// starts with this character
string sSearch = ( (char) e.KeyValue ).ToString();
TreeNode ndCurrent = m_SelectedNode;
while( ( ndCurrent.NextVisibleNode != null ) )
{
ndCurrent = ndCurrent.NextVisibleNode;
if( ndCurrent.Text.StartsWith( sSearch ) )
{
SelectSingleNode( ndCurrent );
break;
}
}
}
}
catch( Exception ex )
{
HandleException( ex );
}
finally
{
this.EndUpdate();
}
}
#endregion
#region Helper Methods
private void SelectNode( TreeNode node )
{
try
{
this.BeginUpdate();
if( m_SelectedNode == null || ModifierKeys == Keys.Control )
{
// Ctrl+Click selects an unselected node, or unselects a selected node.
bool bIsSelected = m_SelectedNodes.Contains( node );
ToggleNode( node, !bIsSelected );
}
else if( ModifierKeys == Keys.Shift )
{
// Shift+Click selects nodes between the selected node and here.
TreeNode ndStart = m_SelectedNode;
TreeNode ndEnd = node;
if( ndStart.Parent == ndEnd.Parent )
{
// Selected node and clicked node have same parent, easy case.
if( ndStart.Index < ndEnd.Index )
{
// If the selected node is beneath the clicked node walk down
// selecting each Visible node until we reach the end.
while( ndStart != ndEnd )
{
ndStart = ndStart.NextVisibleNode;
if( ndStart == null ) break;
ToggleNode( ndStart, true );
}
}
else if( ndStart.Index == ndEnd.Index )
{
// Clicked same node, do nothing
}
else
{
// If the selected node is above the clicked node walk up
// selecting each Visible node until we reach the end.
while( ndStart != ndEnd )
{
ndStart = ndStart.PrevVisibleNode;
if( ndStart == null ) break;
ToggleNode( ndStart, true );
}
}
}
else
{
// Selected node and clicked node have same parent, hard case.
// We need to find a common parent to determine if we need
// to walk down selecting, or walk up selecting.
TreeNode ndStartP = ndStart;
TreeNode ndEndP = ndEnd;
int startDepth = Math.Min( ndStartP.Level, ndEndP.Level );
// Bring lower node up to common depth
while( ndStartP.Level > startDepth )
{
ndStartP = ndStartP.Parent;
}
// Bring lower node up to common depth
while( ndEndP.Level > startDepth )
{
ndEndP = ndEndP.Parent;
}
// Walk up the tree until we find the common parent
while( ndStartP.Parent != ndEndP.Parent )
{
ndStartP = ndStartP.Parent;
ndEndP = ndEndP.Parent;
}
// Select the node
if( ndStartP.Index < ndEndP.Index )
{
// If the selected node is beneath the clicked node walk down
// selecting each Visible node until we reach the end.
while( ndStart != ndEnd )
{
ndStart = ndStart.NextVisibleNode;
if( ndStart == null ) break;
ToggleNode( ndStart, true );
}
}
else if( ndStartP.Index == ndEndP.Index )
{
if( ndStart.Level < ndEnd.Level )
{
while( ndStart != ndEnd )
{
ndStart = ndStart.NextVisibleNode;
if( ndStart == null ) break;
ToggleNode( ndStart, true );
}
}
else
{
while( ndStart != ndEnd )
{
ndStart = ndStart.PrevVisibleNode;
if( ndStart == null ) break;
ToggleNode( ndStart, true );
}
}
}
else
{
// If the selected node is above the clicked node walk up
// selecting each Visible node until we reach the end.
while( ndStart != ndEnd )
{
ndStart = ndStart.PrevVisibleNode;
if( ndStart == null ) break;
ToggleNode( ndStart, true );
}
}
}
}
else
{
// Just clicked a node, select it
SelectSingleNode( node );
}
OnAfterSelect( new TreeViewEventArgs( m_SelectedNode ) );
}
finally
{
this.EndUpdate();
}
}
private void ClearSelectedNodes()
{
try
{
foreach( TreeNode node in m_SelectedNodes )
{
node.BackColor = this.BackColor;
node.ForeColor = this.ForeColor;
}
}
finally
{
m_SelectedNodes.Clear();
m_SelectedNode = null;
}
}
private void SelectSingleNode( TreeNode node )
{
if( node == null )
{
return;
}
ClearSelectedNodes();
ToggleNode( node, true );
node.EnsureVisible();
}
private void ToggleNode( TreeNode node, bool bSelectNode )
{
if( bSelectNode )
{
m_SelectedNode = node;
if( !m_SelectedNodes.Contains( node ) )
{
m_SelectedNodes.Add( node );
}
node.BackColor = SystemColors.Highlight;
node.ForeColor = SystemColors.HighlightText;
}
else
{
m_SelectedNodes.Remove( node );
node.BackColor = this.BackColor;
node.ForeColor = this.ForeColor;
}
}
private void HandleException( Exception ex )
{
// Perform some error handling here.
// We don't want to bubble errors to the CLR.
MessageBox.Show( ex.Message );
}
#endregion
private const int WM_ERASEBKGND = 0x14;
protected override void WndProc (ref Message m)
{
if (m.Msg == WM_ERASEBKGND) //if message is is erase background
{
return;
}
base.WndProc(ref m);
}
}
}

View file

@ -1,25 +0,0 @@
using System.Windows.Forms;
namespace NBTExplorer.Windows
{
public partial class About : Form
{
public About ()
{
InitializeComponent();
int len = linkLabel1.Text.Length;
System.Version version = typeof(About).Assembly.GetName().Version;
linkLabel1.Text = linkLabel1.Text.Replace("{ver}", version.Major + "." + version.Minor + "." + version.Build);
int adj = linkLabel1.Text.Length - len;
linkLabel1.LinkArea = new LinkArea(linkLabel1.LinkArea.Start + adj, linkLabel1.LinkArea.Length);
}
private void linkLabel1_LinkClicked (object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://github.com/jaquadro/NBTExplorer");
}
}
}

View file

@ -1,176 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="linkLabel1.Text" xml:space="preserve">
<value>NBTExplorer {ver}
Copyright ©2011-2017 Justin Aquadro
NBTExplorer is based on NBTEdit by copygirl
Fugue icon set: p.yusukekamiyamane.com
Email: jaquadro@gmail.com
NBTExplorer Github Project Page</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuODc7gF0AAAj7SURBVHhe7dKx
DW25DQTQjVyLC3A3Tl3IL8L92vngBIsBiCeJNzgJgSEokX/9+fPn8zf99z///N/foew2LH5MRyTKbsPi
x3REouw2LH5MRyTKbsPix3REouw2LH5MRyTKbsPix3REouw2LH5MRyTKbsPix3REouw2LH5MRyTKbsPi
x3REouw2LH5MRyTKbsPix3REouw2LH5MRyTKbsPix3REouw2LH5MRyTKbsPix3REouw2LH5MRyTKbsPi
x3REouw2LG6kA0n//tc//hb1n6RZk3KTWNxIy0g6IlH/SZo1KTeJxY20jKQjEvWfpFmTcpNY3EjLSDoi
Uf9JmjUpN4nFjbSMpCMS9Z+kWZNyk1jcSMtIOiJR/0maNSk3icWNtIykIxL1n6RZk3KTWNxIy0g6IlH/
SZo1KTeJxY20jKQjEvWfpFmTcpNY3EjLSDoiUf9JmjUpN4nFjbSMpCMS9Z+kWZPmFPVvsLiRlpG0CFH/
SZo1aU5R/waLG2kZSYsQ9Z+kWZPmFPVvsLiRlpG0CFH/SZo1aU5R/waLG2kZSYsQ9Z+kWZPmFPVvsLiR
lpG0CFH/SZo1aU5R/waLG2kZSYsQ9Z+kWZPmFPVvsLiRlpG0CFH/SZo1aU5R/waLG2kZSYsQ9Z+kWZPm
FPVvsDhND2+od0v9W1pYS/0bevMkFqfp4Q31bql/SwfSUv+G3jyJxWl6eEO9W+rf0oG01L+hN09icZoe
3lDvlvq3dCAt9W/ozZNYnKaHN9S7pf4tHUhL/Rt68yQWp+nhDfVuqX9LB9JS/4bePInFaXp4Q71b6t/S
gbTUv6E3T2Jxmh7eUO+W+rd0IC31b+jNk1icpoc31Lul/i0dSEv9G3rzJBZPoE9O+kBR/4Z6T9O7G+ot
eneDxRPoc5I+RtS/od7T9O6Geove3WDxBPqcpI8R9W+o9zS9u6Heonc3WDyBPifpY0T9G+o9Te9uqLfo
3Q0WT6DPSfoYUf+Gek/TuxvqLXp3g8UT6HOSPkbUv6He0/TuhnqL3t1g8QT6nKSPEfVvqPc0vbuh3qJ3
N1g8gT4n6WNE/RvqPU3vbqi36N0NFk+gz0n6GFH/hnpP07sb6i16d4PFE+hzkj5G1L+h3tP07oZ6i97d
YPEW+kDRByblknKibEvvTsol5SaxeAt9oGj5SbmknCjb0ruTckm5SSzeQh8oWn5SLiknyrb07qRcUm4S
i7fQB4qWn5RLyomyLb07KZeUm8TiLfSBouUn5ZJyomxL707KJeUmsXgLfaBo+Um5pJwo29K7k3JJuUks
3kIfKFp+Ui4pJ8q29O6kXFJuEou30AeKlp+US8qJsi29OymXlJvE4i30gaLlJ+WScqJsS+9OyiXlJrH4
Gn100oEk5Vqa8yUsvkaLTTqkpFxLc76ExddosUmHlJRrac6XsPgaLTbpkJJyLc35EhZfo8UmHVJSrqU5
X8Lia7TYpENKyrU050tYfI0Wm3RISbmW5nwJi6/RYpMOKSnX0pwvYfE1WmzSISXlWprzJSzeQsufpAMR
zdpS/6Tcr7F4Cy1/kpYqmrWl/km5X2PxFlr+JC1VNGtL/ZNyv8biLbT8SVqqaNaW+iflfo3FW2j5k7RU
0awt9U/K/RqLt9DyJ2mpollb6p+U+zUWb6HlT9JSRbO21D8p92ss3kLLn6SlimZtqX9S7tdYvIWWP0lL
Fc3aUv+k3K+xeAstf5KWKpq1pf5JuV9jUfTRt9AyknIt9U/KnUC7b7AoGuIWWmxSrqX+SbkTaPcNFkVD
3EKLTcq11D8pdwLtvsGiaIhbaLFJuZb6J+VOoN03WBQNcQstNinXUv+k3Am0+waLoiFuocUm5Vrqn5Q7
gXbfYFE0xC202KRcS/2TcifQ7hssioa4hRablGupf1LuBNp9g0XRELfQYpNyLfVPyp1Au2+wOE0fPUkz
JH1ySzO0NGtSrqX3JM2QWJymB03SDEkf2NIMLc2alGvpPUkzJBan6UGTNEPSB7Y0Q0uzJuVaek/SDInF
aXrQJM2Q9IEtzdDSrEm5lt6TNENicZoeNEkzJH1gSzO0NGtSrqX3JM2QWJymB03SDEkf2NIMLc2alGvp
PUkzJBan6UGTNEPSB7Y0Q0uzJuVaek/SDInFaXrQJM2Q9IEtzdDSrEm5lt6TNENicZoeNEkzJH1gSzO0
NGtSrqX3JM2QWJymB03SDEkf2NIMLc2alGvpPUkzJBZPoAcl5SZpBtHCWppjkt6TlEssnkAPSspN0gyi
A2lpjkl6T1IusXgCPSgpN0kziA6kpTkm6T1JucTiCfSgpNwkzSA6kJbmmKT3JOUSiyfQg5JykzSD6EBa
mmOS3pOUSyyeQA9Kyk3SDKIDaWmOSXpPUi6xeAI9KCk3STOIDqSlOSbpPUm5xOIJ9KCk3CTNIDqQluaY
pPck5RKLJ9CDknKTNIPoQFqaY5Lek5RLLJ5AD0rKtbTUpBlE2aQZXsLiCbSwpFxLy0+aQZRNmuElLJ5A
C0vKtbT8pBlE2aQZXsLiCbSwpFxLy0+aQZRNmuElLJ5AC0vKtbT8pBlE2aQZXsLiCbSwpFxLy0+aQZRN
muElLJ5AC0vKtbT8pBlE2aQZXsLiCbSwpFxLy0+aQZRNmuElLJ5AC0vKtbT8pBlE2aQZXsLiRjqQlg4p
aYaXsLiRDqSlQ0qa4SUsbqQDaemQkmZ4CYsb6UBaOqSkGV7C4kY6kJYOKWmGl7C4kQ6kpUNKmuElLG6k
A2npkJJmeAmLG+lAWjqkpBlewuJGOpCWDilphpewuJEOpKVDSprhJSxupANp6ZCSZngJixvpQFo6pKQZ
XsLiRjqQlg4paYaXsLiRDqSlQ0qa4SUsbqQDaemQkmZ4CYsb6UBaOqSkGV7C4kY6kJYOKWmGl7C4kQ6k
pUNKmuElLG6kA2npkJJmeAmLG2n5SUckyibN8BIWN9Lyk45IlE2a4SUsbqTlJx2RKJs0w0tY3EjLTzoi
UTZphpewuJGWn3REomzSDC9hcSMtP+mIRNmkGV7C4kZaftIRibJJM7yExY20/KQjEmWTZngJixtp+UlH
JMomzfCOP3/9HzbO2TAq1UXtAAAAAElFTkSuQmCC
</value>
</data>
</root>

View file

@ -1,593 +0,0 @@
using System;
using System.Windows.Forms;
using Be.Windows.Forms;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Drawing;
namespace NBTExplorer.Windows
{
public partial class HexEditor : Form
{
private abstract class EditView
{
protected EditView (StatusStrip statusBar, int bytesPerElem)
{
BytesPerElem = bytesPerElem;
StatusBar = statusBar;
}
public event EventHandler Modified;
public int BytesPerElem { get; set; }
public StatusStrip StatusBar { get; set; }
public abstract TabPage TabPage { get; }
public abstract void Initialize ();
public abstract void Activate ();
public abstract byte[] GetRawData ();
public abstract void SetRawData (byte[] data);
protected virtual void OnModified ()
{
var ev = Modified;
if (ev != null)
ev(this, EventArgs.Empty);
}
}
private class TextView : EditView
{
private TabPage _tabPage;
private TextBox _textBox;
private ToolStripStatusLabel _elementLabel;
private ToolStripStatusLabel _spaceLabel;
private Dictionary<int, int> _elemIndex = new Dictionary<int, int>();
public TextView (StatusStrip statusBar, int bytesPerElem)
: base(statusBar, bytesPerElem)
{ }
public override void Initialize ()
{
_textBox = new TextBox() {
Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
Font = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
Location = new Point(0, 0),
Margin = new Padding(0),
Multiline = true,
ScrollBars = ScrollBars.Vertical,
Size = new Size(500, 263),
TabIndex = 0,
MaxLength = 0,
};
_tabPage = new TabPage() {
Location = new Point(4, 22),
Padding = new Padding(3),
Size = new Size(500, 263),
TabIndex = 1,
Text = "Text View",
UseVisualStyleBackColor = true,
};
_tabPage.Controls.Add(_textBox);
_textBox.TextChanged += (s, e) => { OnModified(); RebuildElementIndex(); };
_textBox.PreviewKeyDown += (s, e) => { e.IsInputKey = true; };
_textBox.KeyUp += (s, e) => { UpdateElementLabel(); };
_textBox.MouseClick += (s, e) => { UpdateElementLabel(); };
InitializeStatusBar();
}
private void InitializeStatusBar ()
{
_elementLabel = new ToolStripStatusLabel() {
Size = new Size(100, 17),
Text = "Element 0",
TextAlign = ContentAlignment.MiddleLeft,
};
_spaceLabel = new ToolStripStatusLabel() {
Spring = true,
};
}
public override void Activate ()
{
StatusBar.Items.Clear();
StatusBar.Items.AddRange(new ToolStripItem[] {
_elementLabel, _spaceLabel,
});
}
public override TabPage TabPage
{
get { return _tabPage; }
}
public override byte[] GetRawData ()
{
return HexEditor.TextToRaw(_textBox.Text, BytesPerElem);
}
public override void SetRawData (byte[] data)
{
_textBox.Text = HexEditor.RawToText(data, BytesPerElem);
RebuildElementIndex();
}
private void RebuildElementIndex ()
{
_elemIndex.Clear();
int element = 0;
String text = _textBox.Text;
bool lcw = true;
for (int i = 0; i < text.Length; i++) {
bool w = IsWhiteSpace(text[i]);
if (lcw && !w)
_elemIndex[i] = element++;
lcw = w;
}
}
private bool IsWhiteSpace (char c)
{
return c == ' ' || c == '\n' || c == '\r' || c == '\t';
}
private void UpdateElementLabel ()
{
int index = _textBox.SelectionStart;
int element = 0;
while (index >= 0 && !_elemIndex.TryGetValue(index, out element))
index--;
_elementLabel.Text = "Element " + element;
}
}
private class HexView : EditView
{
private TabPage _tabPage;
private HexBox _hexBox;
private ToolStripStatusLabel _positionLabel;
private ToolStripStatusLabel _elementLabel;
private ToolStripStatusLabel _spaceLabel;
private ToolStripStatusLabel _insertLabel;
private DynamicByteProvider _byteProvider;
public HexView (StatusStrip statusBar, int bytesPerElem)
: base(statusBar, bytesPerElem)
{ }
public override void Initialize ()
{
_byteProvider = new DynamicByteProvider(new byte[0]);
_byteProvider.Changed += (o, e) => { OnModified(); };
_hexBox = new HexBox() {
Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
Font = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
LineInfoForeColor = Color.Empty,
LineInfoVisible = true,
Location = new Point(0, 0),
ShadowSelectionColor = Color.FromArgb(100, 60, 188, 255),
Size = new Size(500, 263),
TabIndex = 0,
VScrollBarVisible = true,
ByteProvider = _byteProvider,
};
_tabPage = new TabPage() {
Location = new Point(4, 22),
Padding = new Padding(3),
Size = new Size(500, 263),
TabIndex = 0,
Text = "Hex View",
UseVisualStyleBackColor = true,
};
_tabPage.Controls.Add(_hexBox);
_hexBox.HorizontalByteCountChanged += (s, e) => { UpdatePosition(); };
_hexBox.CurrentLineChanged += (s, e) => { UpdatePosition(); };
_hexBox.CurrentPositionInLineChanged += (s, e) => { UpdatePosition(); };
_hexBox.InsertActiveChanged += (s, e) => { _insertLabel.Text = (_hexBox.InsertActive) ? "Insert" : "Overwrite"; };
InitializeStatusBar();
}
private void InitializeStatusBar ()
{
_positionLabel = new ToolStripStatusLabel() {
AutoSize = false,
Size = new Size(100, 17),
Text = "0000",
};
_elementLabel = new ToolStripStatusLabel() {
Size = new Size(59, 17),
Text = "Element 0",
TextAlign = ContentAlignment.MiddleLeft,
};
_spaceLabel = new ToolStripStatusLabel() {
Size = new Size(300, 17),
Spring = true,
};
_insertLabel = new ToolStripStatusLabel() {
Size = new Size(58, 17),
Text = (_hexBox.InsertActive) ? "Insert" : "Overwrite",
};
}
public override void Activate ()
{
StatusBar.Items.Clear();
StatusBar.Items.AddRange(new ToolStripItem[] {
_positionLabel, _elementLabel, _spaceLabel, _insertLabel,
});
UpdatePosition();
}
public override TabPage TabPage
{
get { return _tabPage; }
}
public override byte[] GetRawData ()
{
byte[] data = new byte[_byteProvider.Length];
for (int i = 0; i < data.Length; i++) {
data[i] = _byteProvider.Bytes[i];
}
return data;
}
public override void SetRawData (byte[] data)
{
_byteProvider = new DynamicByteProvider(data);
_byteProvider.Changed += (o, e2) => { OnModified(); };
_hexBox.ByteProvider = _byteProvider;
}
private void UpdatePosition ()
{
long pos = (_hexBox.CurrentLine - 1) * _hexBox.HorizontalByteCount + _hexBox.CurrentPositionInLine - 1;
_positionLabel.Text = "0x" + pos.ToString("X4");
_elementLabel.Text = "Element " + pos / BytesPerElem;
}
}
private class FixedByteProvider : DynamicByteProvider
{
public FixedByteProvider (byte[] data)
: base(data)
{ }
public override bool SupportsInsertBytes ()
{
return false;
}
}
private TabPage _previousPage;
private int _bytesPerElem;
private byte[] _data;
private bool _modified;
private Dictionary<TabPage, EditView> _views = new Dictionary<TabPage, EditView>();
public HexEditor (string tagName, byte[] data, int bytesPerElem)
{
InitializeComponent();
EditView textView = new TextView(statusStrip1, bytesPerElem);
textView.Initialize();
textView.SetRawData(data);
textView.Modified += (s, e) => { _modified = true; };
_views.Add(textView.TabPage, textView);
viewTabs.TabPages.Add(textView.TabPage);
EditView hexView = null;
if (!IsMono()) {
hexView = new HexView(statusStrip1, bytesPerElem);
hexView.Initialize();
hexView.SetRawData(data);
hexView.Modified += (s, e) => { _modified = true; };
_views.Add(hexView.TabPage, hexView);
viewTabs.TabPages.Add(hexView.TabPage);
}
if (bytesPerElem > 1 || IsMono()) {
textView.Activate();
viewTabs.SelectedTab = textView.TabPage;
}
else {
hexView.Activate();
viewTabs.SelectedTab = hexView.TabPage;
}
viewTabs.Deselected += (o, e) => { _previousPage = e.TabPage; };
viewTabs.Selecting += HandleTabChanged;
this.Text = "Editing: " + tagName;
_bytesPerElem = bytesPerElem;
_data = new byte[data.Length];
Array.Copy(data, _data, data.Length);
}
private bool IsMono ()
{
return Type.GetType("Mono.Runtime") != null;
}
public byte[] Data
{
get { return _data; }
}
public bool Modified
{
get { return _modified; }
}
private void HandleTabChanged (object sender, TabControlCancelEventArgs e)
{
if (e.Action != TabControlAction.Selecting)
return;
if (e.TabPage == _previousPage)
return;
EditView oldView = _views[_previousPage];
EditView newView = _views[e.TabPage];
byte[] data = oldView.GetRawData();
newView.SetRawData(data);
newView.Activate();
}
private void Apply ()
{
EditView view = _views[viewTabs.SelectedTab];
_data = view.GetRawData();
DialogResult = DialogResult.OK;
Close();
}
private String RawToText (byte[] data)
{
return RawToText(data, _bytesPerElem);
}
private static String RawToText (byte[] data, int bytesPerElem)
{
switch (bytesPerElem) {
case 1: return RawToText(data, bytesPerElem, 16);
case 2: return RawToText(data, bytesPerElem, 8);
case 4: return RawToText(data, bytesPerElem, 4);
case 8: return RawToText(data, bytesPerElem, 2);
default: return RawToText(data, bytesPerElem, 1);
}
}
private static String RawToText (byte[] data, int bytesPerElem, int elementsPerLine)
{
StringBuilder builder = new StringBuilder();
for (int i = 0; i < data.Length; i += bytesPerElem) {
if (data.Length - i < bytesPerElem)
break;
switch (bytesPerElem) {
case 1:
builder.Append(((sbyte)data[i]).ToString());
break;
case 2:
builder.Append(BitConverter.ToInt16(data, i).ToString());
break;
case 4:
builder.Append(BitConverter.ToInt32(data, i).ToString());
break;
case 8:
builder.Append(BitConverter.ToInt64(data, i).ToString());
break;
}
if ((i / bytesPerElem) % elementsPerLine == elementsPerLine - 1)
builder.AppendLine();
else
builder.Append(" ");
}
return builder.ToString();
}
private byte[] TextToRaw (string text)
{
return TextToRaw(text, _bytesPerElem);
}
private static byte[] TextToRaw (string text, int bytesPerElem)
{
string[] items = text.Split(null as char[], StringSplitOptions.RemoveEmptyEntries);
byte[] data = new byte[bytesPerElem * items.Length];
for (int i = 0; i < items.Length; i++) {
int index = i * bytesPerElem;
switch (bytesPerElem) {
case 1:
sbyte val1;
if (sbyte.TryParse(items[i], out val1))
data[index] = (byte)val1;
break;
case 2:
short val2;
if (short.TryParse(items[i], out val2)) {
byte[] buffer = BitConverter.GetBytes(val2);
Array.Copy(buffer, 0, data, index, 2);
}
break;
case 4:
int val4;
if (int.TryParse(items[i], out val4)) {
byte[] buffer = BitConverter.GetBytes(val4);
Array.Copy(buffer, 0, data, index, 4);
}
break;
case 8:
long val8;
if (long.TryParse(items[i], out val8)) {
byte[] buffer = BitConverter.GetBytes(val8);
Array.Copy(buffer, 0, data, index, 8);
}
break;
}
}
return data;
}
private void ImportRaw (string path)
{
try {
using (FileStream fstr = File.OpenRead(path)) {
_data = new byte[fstr.Length];
fstr.Read(_data, 0, (int)fstr.Length);
EditView view = _views[viewTabs.SelectedTab];
view.SetRawData(_data);
_modified = true;
}
}
catch (Exception e) {
MessageBox.Show("Failed to import data from \"" + path + "\"\n\nException: " + e.Message);
}
}
private void ImportText (string path)
{
try {
using (FileStream fstr = File.OpenRead(path)) {
byte[] raw = new byte[fstr.Length];
fstr.Read(raw, 0, (int)fstr.Length);
string text = System.Text.Encoding.UTF8.GetString(raw, 0, raw.Length);
_data = TextToRaw(text);
EditView view = _views[viewTabs.SelectedTab];
view.SetRawData(_data);
_modified = true;
}
}
catch (Exception e) {
MessageBox.Show("Failed to import data from \"" + path + "\"\n\nException: " + e.Message);
}
}
private void ExportRaw (string path)
{
try {
using (FileStream fstr = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None)) {
EditView view = _views[viewTabs.SelectedTab];
byte[] data = view.GetRawData();
fstr.Write(data, 0, data.Length);
}
}
catch (Exception e) {
MessageBox.Show("Failed to export data to \"" + path + "\"\n\nException: " + e.Message);
}
}
private void ExportText (string path)
{
try {
using (FileStream fstr = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None)) {
EditView view = _views[viewTabs.SelectedTab];
string text = RawToText(view.GetRawData());
byte[] data = System.Text.Encoding.UTF8.GetBytes(text);
fstr.Write(data, 0, data.Length);
}
}
catch (Exception e) {
MessageBox.Show("Failed to export data to \"" + path + "\"\n\nException: " + e.Message);
}
}
private void _buttonOK_Click (object sender, EventArgs e)
{
Apply();
}
private void _buttonImport_Click (object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog()) {
ofd.RestoreDirectory = true;
ofd.Multiselect = false;
ofd.Filter = "Binary Data|*|Text Data (*.txt)|*.txt";
ofd.FilterIndex = 0;
if (ofd.ShowDialog() == DialogResult.OK) {
if (Path.GetExtension(ofd.FileName) == ".txt")
ImportText(ofd.FileName);
else
ImportRaw(ofd.FileName);
}
}
}
private void _buttonExport_Click (object sender, EventArgs e)
{
using (SaveFileDialog sfd = new SaveFileDialog()) {
sfd.RestoreDirectory = true;
sfd.Filter = "Binary Data|*|Text Data (*.txt)|*.txt";
sfd.FilterIndex = 0;
sfd.OverwritePrompt = true;
if (sfd.ShowDialog() == DialogResult.OK) {
if (Path.GetExtension(sfd.FileName) == ".txt")
ExportText(sfd.FileName);
else
ExportRaw(sfd.FileName);
}
}
}
}
}

View file

@ -1,455 +0,0 @@
namespace NBTExplorer.Windows
{
partial class FindBlock
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose (bool disposing)
{
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent ()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this._findButton = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this._cancelButton = new System.Windows.Forms.Button();
this._blockZTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._blockXTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._chunkZTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._chunkXTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._regionZTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._regionXTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._localChunkXTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._localChunkZTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._localBlockZTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this._localBlockXTextBox = new NBTExplorer.Windows.WatermarkTextBox();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this._regionZTextBox);
this.groupBox1.Controls.Add(this._regionXTextBox);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(142, 70);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Region";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Controls.Add(this.groupBox3, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox4, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.groupBox5, 2, 1);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(446, 152);
this.tableLayoutPanel1.TabIndex = 1;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this._chunkZTextBox);
this.groupBox2.Controls.Add(this._chunkXTextBox);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(151, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(142, 70);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Chunk";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label5);
this.groupBox3.Controls.Add(this.label6);
this.groupBox3.Controls.Add(this._blockZTextBox);
this.groupBox3.Controls.Add(this._blockXTextBox);
this.groupBox3.Location = new System.Drawing.Point(299, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(144, 70);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Block";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(17, 13);
this.label1.TabIndex = 2;
this.label1.Text = "X:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(17, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Z:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(17, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Z:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(17, 13);
this.label4.TabIndex = 4;
this.label4.Text = "X:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 48);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(17, 13);
this.label5.TabIndex = 7;
this.label5.Text = "Z:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 22);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(17, 13);
this.label6.TabIndex = 6;
this.label6.Text = "X:";
//
// _findButton
//
this._findButton.Location = new System.Drawing.Point(383, 170);
this._findButton.Name = "_findButton";
this._findButton.Size = new System.Drawing.Size(75, 23);
this._findButton.TabIndex = 2;
this._findButton.Text = "Find Chunk";
this._findButton.UseVisualStyleBackColor = true;
this._findButton.Click += new System.EventHandler(this._findButton_Click);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label7);
this.groupBox4.Controls.Add(this._localChunkXTextBox);
this.groupBox4.Controls.Add(this.label8);
this.groupBox4.Controls.Add(this._localChunkZTextBox);
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox4.Location = new System.Drawing.Point(151, 79);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(142, 70);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Local Chunk";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.label9);
this.groupBox5.Controls.Add(this.label10);
this.groupBox5.Controls.Add(this._localBlockZTextBox);
this.groupBox5.Controls.Add(this._localBlockXTextBox);
this.groupBox5.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox5.Location = new System.Drawing.Point(299, 79);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(144, 70);
this.groupBox5.TabIndex = 4;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Local Block";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 48);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(17, 13);
this.label7.TabIndex = 9;
this.label7.Text = "Z:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 22);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(17, 13);
this.label8.TabIndex = 8;
this.label8.Text = "X:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(8, 48);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(17, 13);
this.label9.TabIndex = 9;
this.label9.Text = "Z:";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(8, 22);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(17, 13);
this.label10.TabIndex = 8;
this.label10.Text = "X:";
//
// _cancelButton
//
this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this._cancelButton.Location = new System.Drawing.Point(302, 171);
this._cancelButton.Name = "_cancelButton";
this._cancelButton.Size = new System.Drawing.Size(75, 23);
this._cancelButton.TabIndex = 3;
this._cancelButton.Text = "Cancel";
this._cancelButton.UseVisualStyleBackColor = true;
this._cancelButton.Click += new System.EventHandler(this._cancelButton_Click);
//
// _blockZTextBox
//
this._blockZTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._blockZTextBox.ForeColor = System.Drawing.Color.Gray;
this._blockZTextBox.Location = new System.Drawing.Point(38, 45);
this._blockZTextBox.Name = "_blockZTextBox";
this._blockZTextBox.Size = new System.Drawing.Size(100, 20);
this._blockZTextBox.TabIndex = 1;
this._blockZTextBox.Text = "Type here";
this._blockZTextBox.WatermarkActive = true;
this._blockZTextBox.WatermarkText = "Type here";
this._blockZTextBox.TextChanged += new System.EventHandler(this._blockZTextBox_TextChanged);
//
// _blockXTextBox
//
this._blockXTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._blockXTextBox.ForeColor = System.Drawing.Color.Gray;
this._blockXTextBox.Location = new System.Drawing.Point(38, 19);
this._blockXTextBox.Name = "_blockXTextBox";
this._blockXTextBox.Size = new System.Drawing.Size(100, 20);
this._blockXTextBox.TabIndex = 0;
this._blockXTextBox.Text = "Type here";
this._blockXTextBox.WatermarkActive = true;
this._blockXTextBox.WatermarkText = "Type here";
this._blockXTextBox.TextChanged += new System.EventHandler(this._blockXTextBox_TextChanged);
//
// _chunkZTextBox
//
this._chunkZTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._chunkZTextBox.ForeColor = System.Drawing.Color.Gray;
this._chunkZTextBox.Location = new System.Drawing.Point(36, 45);
this._chunkZTextBox.Name = "_chunkZTextBox";
this._chunkZTextBox.Size = new System.Drawing.Size(100, 20);
this._chunkZTextBox.TabIndex = 1;
this._chunkZTextBox.Text = "Type here";
this._chunkZTextBox.WatermarkActive = true;
this._chunkZTextBox.WatermarkText = "Type here";
this._chunkZTextBox.TextChanged += new System.EventHandler(this._chunkZTextBox_TextChanged);
//
// _chunkXTextBox
//
this._chunkXTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._chunkXTextBox.ForeColor = System.Drawing.Color.Gray;
this._chunkXTextBox.Location = new System.Drawing.Point(36, 19);
this._chunkXTextBox.Name = "_chunkXTextBox";
this._chunkXTextBox.Size = new System.Drawing.Size(100, 20);
this._chunkXTextBox.TabIndex = 0;
this._chunkXTextBox.Text = "Type here";
this._chunkXTextBox.WatermarkActive = true;
this._chunkXTextBox.WatermarkText = "Type here";
this._chunkXTextBox.TextChanged += new System.EventHandler(this._chunkXTextBox_TextChanged);
//
// _regionZTextBox
//
this._regionZTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._regionZTextBox.ForeColor = System.Drawing.Color.Gray;
this._regionZTextBox.Location = new System.Drawing.Point(36, 45);
this._regionZTextBox.Name = "_regionZTextBox";
this._regionZTextBox.Size = new System.Drawing.Size(100, 20);
this._regionZTextBox.TabIndex = 1;
this._regionZTextBox.Text = "Type here";
this._regionZTextBox.WatermarkActive = true;
this._regionZTextBox.WatermarkText = "Type here";
this._regionZTextBox.TextChanged += new System.EventHandler(this._regionZTextBox_TextChanged);
//
// _regionXTextBox
//
this._regionXTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._regionXTextBox.ForeColor = System.Drawing.Color.Gray;
this._regionXTextBox.Location = new System.Drawing.Point(36, 19);
this._regionXTextBox.Name = "_regionXTextBox";
this._regionXTextBox.Size = new System.Drawing.Size(100, 20);
this._regionXTextBox.TabIndex = 0;
this._regionXTextBox.Text = "Type here";
this._regionXTextBox.WatermarkActive = true;
this._regionXTextBox.WatermarkText = "Type here";
this._regionXTextBox.TextChanged += new System.EventHandler(this._regionXTextBox_TextChanged);
//
// _localChunkXTextBox
//
this._localChunkXTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._localChunkXTextBox.ForeColor = System.Drawing.Color.Gray;
this._localChunkXTextBox.Location = new System.Drawing.Point(36, 19);
this._localChunkXTextBox.Name = "_localChunkXTextBox";
this._localChunkXTextBox.Size = new System.Drawing.Size(100, 20);
this._localChunkXTextBox.TabIndex = 6;
this._localChunkXTextBox.Text = "Type here";
this._localChunkXTextBox.WatermarkActive = true;
this._localChunkXTextBox.WatermarkText = "Type here";
this._localChunkXTextBox.TextChanged += new System.EventHandler(this._localChunkXTextBox_TextChanged);
//
// _localChunkZTextBox
//
this._localChunkZTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._localChunkZTextBox.ForeColor = System.Drawing.Color.Gray;
this._localChunkZTextBox.Location = new System.Drawing.Point(36, 45);
this._localChunkZTextBox.Name = "_localChunkZTextBox";
this._localChunkZTextBox.Size = new System.Drawing.Size(100, 20);
this._localChunkZTextBox.TabIndex = 7;
this._localChunkZTextBox.Text = "Type here";
this._localChunkZTextBox.WatermarkActive = true;
this._localChunkZTextBox.WatermarkText = "Type here";
this._localChunkZTextBox.TextChanged += new System.EventHandler(this._localChunkZTextBox_TextChanged);
//
// _localBlockZTextBox
//
this._localBlockZTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._localBlockZTextBox.ForeColor = System.Drawing.Color.Gray;
this._localBlockZTextBox.Location = new System.Drawing.Point(38, 45);
this._localBlockZTextBox.Name = "_localBlockZTextBox";
this._localBlockZTextBox.Size = new System.Drawing.Size(100, 20);
this._localBlockZTextBox.TabIndex = 7;
this._localBlockZTextBox.Text = "Type here";
this._localBlockZTextBox.WatermarkActive = true;
this._localBlockZTextBox.WatermarkText = "Type here";
this._localBlockZTextBox.TextChanged += new System.EventHandler(this._localBlockZTextBox_TextChanged);
//
// _localBlockXTextBox
//
this._localBlockXTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this._localBlockXTextBox.ForeColor = System.Drawing.Color.Gray;
this._localBlockXTextBox.Location = new System.Drawing.Point(38, 19);
this._localBlockXTextBox.Name = "_localBlockXTextBox";
this._localBlockXTextBox.Size = new System.Drawing.Size(100, 20);
this._localBlockXTextBox.TabIndex = 6;
this._localBlockXTextBox.Text = "Type here";
this._localBlockXTextBox.WatermarkActive = true;
this._localBlockXTextBox.WatermarkText = "Type here";
this._localBlockXTextBox.TextChanged += new System.EventHandler(this._localBlockXTextBox_TextChanged);
//
// FindBlock
//
this.AcceptButton = this._findButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this._cancelButton;
this.ClientSize = new System.Drawing.Size(470, 206);
this.Controls.Add(this._cancelButton);
this.Controls.Add(this._findButton);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "FindBlock";
this.Text = "Chunk Finder";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private WatermarkTextBox _regionZTextBox;
private WatermarkTextBox _regionXTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private WatermarkTextBox _blockZTextBox;
private WatermarkTextBox _blockXTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private WatermarkTextBox _chunkZTextBox;
private WatermarkTextBox _chunkXTextBox;
private System.Windows.Forms.Button _findButton;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label7;
private WatermarkTextBox _localChunkXTextBox;
private System.Windows.Forms.Label label8;
private WatermarkTextBox _localChunkZTextBox;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private WatermarkTextBox _localBlockZTextBox;
private WatermarkTextBox _localBlockXTextBox;
private System.Windows.Forms.Button _cancelButton;
}
}

View file

@ -1,530 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using NBTExplorer.Model;
namespace NBTExplorer.Windows
{
public partial class FindBlock : Form
{
private class CoordinateGroup
{
public int? Region;
public int? Chunk;
public int? Block;
public int? LocalChunk;
public int? LocalBlock;
public WatermarkTextBox RegionBox;
public WatermarkTextBox ChunkBox;
public WatermarkTextBox BlockBox;
public WatermarkTextBox LocalChunkBox;
public WatermarkTextBox LocalBlockBox;
}
private bool _inUpdate;
private CoordinateGroup _groupX;
private CoordinateGroup _groupZ;
private DataNode _searchRoot;
private DataNode _searchResult;
public FindBlock (DataNode searchRoot)
{
InitializeComponent();
_searchRoot = searchRoot;
_groupX = new CoordinateGroup() {
RegionBox = _regionXTextBox,
ChunkBox = _chunkXTextBox,
BlockBox = _blockXTextBox,
LocalChunkBox = _localChunkXTextBox,
LocalBlockBox = _localBlockXTextBox,
};
_groupZ = new CoordinateGroup() {
RegionBox = _regionZTextBox,
ChunkBox = _chunkZTextBox,
BlockBox = _blockZTextBox,
LocalChunkBox = _localChunkZTextBox,
LocalBlockBox = _localBlockZTextBox,
};
ApplyRegion(_groupX, "0", true);
ApplyRegion(_groupZ, "0", true);
Validate();
}
public DataNode Result
{
get { return _searchResult; }
}
private DataNode Search (DataNode node)
{
if (node is DirectoryDataNode) {
DirectoryDataNode dirNode = node as DirectoryDataNode;
if (!dirNode.IsExpanded)
dirNode.Expand();
foreach (var subNode in dirNode.Nodes) {
DataNode resultNode = Search(subNode);
if (resultNode != null)
return resultNode;
}
return null;
}
else if (node is RegionFileDataNode) {
RegionFileDataNode regionNode = node as RegionFileDataNode;
int rx, rz;
if (!RegionFileDataNode.RegionCoordinates(regionNode.NodePathName, out rx, out rz))
return null;
if (rx != _groupX.Region.Value || rz != _groupZ.Region.Value)
return null;
if (!regionNode.IsExpanded)
regionNode.Expand();
foreach (var subNode in regionNode.Nodes) {
DataNode resultNode = Search(subNode);
if (resultNode != null)
return resultNode;
}
return null;
}
else if (node is RegionChunkDataNode) {
RegionChunkDataNode chunkNode = node as RegionChunkDataNode;
if (chunkNode.X != _groupX.LocalChunk.Value || chunkNode.Z != _groupZ.LocalChunk.Value)
return null;
return chunkNode;
}
return null;
}
private int Mod (int a, int b)
{
return ((a % b) + b) % b;
}
// Block Set
private string RegionFromBlock (int block)
{
return ((block >> 4) >> 5).ToString();
}
private string ChunkFromBlock (int block)
{
return (block >> 4).ToString();
}
private string LocalChunkFromBlock (int block)
{
return Mod(block >> 4, 32).ToString();
}
private string LocalBlockFromBlock (int block)
{
return Mod(block, 16).ToString();
}
// Chunk Set
private string RegionFromChunk (int chunk)
{
return (chunk >> 5).ToString();
}
private string BlockFromChunk (int chunk)
{
int start = chunk * 16;
int end = (chunk + 1) * 16 - 1;
return string.Format("({0} to {1})", start, end);
}
private string BlockFromChunk (int chunk, int localBlock)
{
return (chunk * 16 + localBlock).ToString();
}
private string LocalChunkFromChunk (int chunk)
{
return Mod(chunk, 32).ToString();
}
private string LocalBlockFromChunk (int chunk)
{
return "(0 to 15)";
}
// Region Set
private string ChunkFromRegion (int region)
{
int start = region * 32;
int end = (region + 1) * 32 - 1;
return string.Format("({0} to {1})", start, end);
}
private string BlockFromRegion (int region)
{
int start = region * 32 * 16;
int end = (region + 1) * 32 * 16 - 1;
return string.Format("({0} to {1})", start, end);
}
private string LocalChunkFromRegion (int region)
{
return "(0 to 31)";
}
private string LocalBlockFromRegion (int region)
{
return "(0 to 15)";
}
// Local Chunk Set
private string RegionFromLocalChunk (int localChunk)
{
return "(ANY)";
}
private string ChunkFromLocalChunk (int localChunk)
{
return "(ANY)";
}
private string ChunkFromLocalChunk (int region, int localChunk)
{
return (region * 32 + localChunk).ToString();
}
private string BlockFromLocalChunk (int localChunk)
{
return "(ANY)";
}
private string BlockFromLocalChunk (int region, int localChunk)
{
return BlockFromChunk(region * 32 + localChunk);
}
private string LocalBlockFromLocalChunk (int localChunk)
{
return "(0 to 15)";
}
private string LocalBlockFromLocalChunk (int region, int localChunk)
{
return "(0 to 15)";
}
// Local Block Set
private string RegionFromLocalBlock (int localBlock)
{
return "(ANY)";
}
private string ChunkFromLocalBlock (int localBlock)
{
return "(ANY)";
}
private string ChunkFromLocalBlock (int region, int localChunk, int localBlock)
{
return (region * 32 + localChunk).ToString();
}
private string BlockFromLocalBlock (int localBlock)
{
return "(ANY)";
}
private string BlockFromLocalBlock (int region, int localChunk, int localBlock)
{
return (region * 32 * 16 + localChunk * 16 + localBlock).ToString();
}
private int? ParseInt (string value)
{
int parsedValue;
if (int.TryParse(value, out parsedValue))
return parsedValue;
else
return null;
}
private void ApplyValueToTextBox (WatermarkTextBox textBox, string value, bool primary)
{
if (primary)
textBox.ApplyText(value);
else
textBox.ApplyWatermark(value);
}
private void ApplyRegion (CoordinateGroup group, string value, bool primary)
{
group.Region = ParseInt(value);
ApplyValueToTextBox(group.RegionBox, value, primary);
if (primary && group.Region.HasValue) {
if (group.LocalChunk.HasValue && !group.LocalChunkBox.WatermarkActive) {
ApplyChunk(group, ChunkFromLocalChunk(group.Region.Value, group.LocalChunk.Value), false);
if (group.LocalBlock.HasValue && !group.LocalBlockBox.WatermarkActive)
ApplyBlock(group, BlockFromLocalBlock(group.Region.Value, group.LocalChunk.Value, group.LocalBlock.Value), false);
else {
ApplyBlock(group, BlockFromLocalChunk(group.Region.Value, group.LocalChunk.Value), false);
ApplyLocalBlock(group, LocalBlockFromLocalChunk(group.Region.Value, group.LocalChunk.Value), false);
}
}
else {
ApplyChunk(group, ChunkFromRegion(group.Region.Value), false);
ApplyBlock(group, BlockFromRegion(group.Region.Value), false);
ApplyLocalChunk(group, LocalChunkFromRegion(group.Region.Value), false);
ApplyLocalBlock(group, LocalBlockFromRegion(group.Region.Value), false);
}
}
}
private void ApplyChunk (CoordinateGroup group, string value, bool primary)
{
group.Chunk = ParseInt(value);
ApplyValueToTextBox(group.ChunkBox, value, primary);
if (primary && group.Chunk.HasValue) {
ApplyRegion(group, RegionFromChunk(group.Chunk.Value), false);
ApplyLocalChunk(group, LocalChunkFromChunk(group.Chunk.Value), false);
if (group.LocalBlock.HasValue && !group.LocalBlockBox.WatermarkActive)
ApplyBlock(group, BlockFromChunk(group.Chunk.Value, group.LocalBlock.Value), false);
else {
ApplyBlock(group, BlockFromChunk(group.Chunk.Value), false);
ApplyLocalBlock(group, LocalBlockFromChunk(group.Chunk.Value), false);
}
}
}
private void ApplyBlock (CoordinateGroup group, string value, bool primary)
{
group.Block = ParseInt(value);
ApplyValueToTextBox(group.BlockBox, value, primary);
if (primary && group.Block.HasValue) {
ApplyRegion(group, RegionFromBlock(group.Block.Value), false);
ApplyChunk(group, ChunkFromBlock(group.Block.Value), false);
ApplyLocalChunk(group, LocalChunkFromBlock(group.Block.Value), false);
ApplyLocalBlock(group, LocalBlockFromBlock(group.Block.Value), false);
}
}
private void ApplyLocalChunk (CoordinateGroup group, string value, bool primary)
{
group.LocalChunk = ParseInt(value);
ApplyValueToTextBox(group.LocalChunkBox, value, primary);
if (primary && group.LocalChunk.HasValue) {
if (group.Region.HasValue) {
ApplyChunk(group, ChunkFromLocalChunk(group.Region.Value, group.LocalChunk.Value), false);
if (group.LocalBlock.HasValue && !group.LocalBlockBox.WatermarkActive)
ApplyBlock(group, BlockFromLocalBlock(group.Region.Value, group.LocalChunk.Value, group.LocalBlock.Value), false);
else {
ApplyBlock(group, BlockFromLocalChunk(group.Region.Value, group.LocalChunk.Value), false);
ApplyLocalBlock(group, LocalBlockFromLocalChunk(group.Region.Value, group.LocalChunk.Value), false);
}
}
else {
ApplyRegion(group, RegionFromLocalChunk(group.LocalChunk.Value), false);
ApplyChunk(group, ChunkFromLocalChunk(group.LocalChunk.Value), false);
ApplyBlock(group, BlockFromLocalChunk(group.LocalChunk.Value), false);
ApplyLocalBlock(group, LocalBlockFromLocalChunk(group.LocalChunk.Value), false);
}
}
}
private void ApplyLocalBlock (CoordinateGroup group, string value, bool primary)
{
group.LocalBlock = ParseInt(value);
ApplyValueToTextBox(group.LocalBlockBox, value, primary);
if (primary && group.LocalBlock.HasValue) {
if (group.Region.HasValue && group.LocalChunk.HasValue && !group.LocalChunkBox.WatermarkActive) {
ApplyChunk(group, ChunkFromLocalBlock(group.Region.Value, group.LocalChunk.Value, group.LocalBlock.Value), false);
ApplyBlock(group, BlockFromLocalBlock(group.Region.Value, group.LocalChunk.Value, group.LocalBlock.Value), false);
}
else {
ApplyRegion(group, RegionFromLocalBlock(group.LocalBlock.Value), false);
ApplyChunk(group, ChunkFromLocalBlock(group.LocalBlock.Value), false);
ApplyBlock(group, BlockFromLocalBlock(group.LocalBlock.Value), false);
}
}
}
private void Validate ()
{
if (_groupX.LocalChunk.HasValue && _groupZ.LocalChunk.HasValue)
_findButton.Enabled = true;
else
_findButton.Enabled = false;
}
private void _regionXTextBox_TextChanged (object sender, EventArgs e)
{
int region = 0;
if (_inUpdate || !int.TryParse(_regionXTextBox.Text, out region))
return;
_inUpdate = true;
ApplyRegion(_groupX, _regionXTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _regionZTextBox_TextChanged (object sender, EventArgs e)
{
int region = 0;
if (_inUpdate || !int.TryParse(_regionZTextBox.Text, out region))
return;
_inUpdate = true;
ApplyRegion(_groupZ, _regionZTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _chunkXTextBox_TextChanged (object sender, EventArgs e)
{
int chunk = 0;
if (_inUpdate || !int.TryParse(_chunkXTextBox.Text, out chunk))
return;
_inUpdate = true;
ApplyChunk(_groupX, _chunkXTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _chunkZTextBox_TextChanged (object sender, EventArgs e)
{
int chunk = 0;
if (_inUpdate || !int.TryParse(_chunkZTextBox.Text, out chunk))
return;
_inUpdate = true;
ApplyChunk(_groupZ, _chunkZTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _blockXTextBox_TextChanged (object sender, EventArgs e)
{
int block = 0;
if (_inUpdate || !int.TryParse(_blockXTextBox.Text, out block))
return;
_inUpdate = true;
ApplyBlock(_groupX, _blockXTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _blockZTextBox_TextChanged (object sender, EventArgs e)
{
int block = 0;
if (_inUpdate || !int.TryParse(_blockZTextBox.Text, out block))
return;
_inUpdate = true;
ApplyBlock(_groupZ, _blockZTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _localChunkXTextBox_TextChanged (object sender, EventArgs e)
{
int localChunk = 0;
if (_inUpdate || !int.TryParse(_localChunkXTextBox.Text, out localChunk))
return;
_inUpdate = true;
ApplyLocalChunk(_groupX, _localChunkXTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _localChunkZTextBox_TextChanged (object sender, EventArgs e)
{
int localChunk = 0;
if (_inUpdate || !int.TryParse(_localChunkZTextBox.Text, out localChunk))
return;
_inUpdate = true;
ApplyLocalChunk(_groupZ, _localChunkZTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _localBlockXTextBox_TextChanged (object sender, EventArgs e)
{
int localBlock = 0;
if (_inUpdate || !int.TryParse(_localBlockXTextBox.Text, out localBlock))
return;
_inUpdate = true;
ApplyLocalBlock(_groupX, _localBlockXTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _localBlockZTextBox_TextChanged (object sender, EventArgs e)
{
int localBlock = 0;
if (_inUpdate || !int.TryParse(_localBlockZTextBox.Text, out localBlock))
return;
_inUpdate = true;
ApplyLocalBlock(_groupZ, _localBlockZTextBox.Text, true);
_inUpdate = false;
Validate();
}
private void _findButton_Click (object sender, EventArgs e)
{
_searchResult = Search(_searchRoot);
DialogResult = DialogResult.OK;
Close();
}
private void _cancelButton_Click (object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View file

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

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