Merge commit '491b13aec3002d075f9dc7bc3c05833951234176' into mac-ui

Conflicts:
	NBTExplorer.csproj
Restructuring project
This commit is contained in:
Justin Aquadro 2012-11-04 23:34:59 -05:00
commit f6aeb77ffe
70 changed files with 3893 additions and 272 deletions

View file

@ -1,121 +0,0 @@
using Substrate.Core;
using Substrate.Nbt;
using System.Collections.Generic;
using System;
using System.Windows.Forms;
namespace NBTExplorer
{
public class DataNodeOld
{
public DataNodeOld ()
{
}
public DataNodeOld (DataNodeOld parent)
{
Parent = parent;
}
public DataNodeOld Parent { get; set; }
private bool _modified;
public bool Modified
{
get { return _modified; }
set
{
if (value && Parent != null) {
Parent.Modified = value;
}
_modified = value;
}
}
public bool Expanded { get; set; }
}
public class NbtDataNode : DataNodeOld
{
public NbtDataNode ()
{
}
public NbtDataNode (DataNodeOld parent)
: base(parent)
{
}
public NbtTree Tree { get; set; }
}
public class RegionChunkData : NbtDataNode
{
public RegionChunkData (RegionFile file, int x, int z)
: this(null, file, x, z)
{
}
public RegionChunkData (DataNodeOld parent, RegionFile file, int x, int z)
: base(parent)
{
Region = file;
X = x;
Z = z;
}
public RegionFile Region { get; private set; }
public int X { get; private set; }
public int Z { get; private set; }
}
public class RegionData : DataNodeOld
{
public RegionData (string path)
: this(null, path)
{
}
public RegionData (DataNodeOld parent, string path)
: base(parent)
{
Path = path;
}
public string Path { get; private set; }
}
public class NbtFileData : NbtDataNode
{
public NbtFileData (string path, CompressionType cztype)
: this(null, path, cztype)
{
}
public NbtFileData (DataNodeOld parent, string path, CompressionType cztype)
: base(parent)
{
Path = path;
CompressionType = cztype;
}
public string Path { get; private set; }
public CompressionType CompressionType { get; private set; }
}
public class DirectoryData : DataNodeOld
{
public DirectoryData (string path)
: this(null, path)
{
}
public DirectoryData (DataNodeOld parent, string path)
: base(parent)
{
Path = path;
}
public string Path { get; private set; }
}
}

61
FormRegistry.cs Normal file
View file

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using Substrate.Nbt;
namespace NBTExplorer
{
public static class FormRegistry
{
public delegate bool EditStringAction (StringFormData data);
public delegate bool EditRestrictedStringAction (RestrictedStringFormData data);
public delegate bool EditTagScalarAction (TagScalarFormData data);
public delegate bool EditByteArrayAction (ByteArrayFormData data);
public static EditStringAction EditString { get; set; }
public static EditRestrictedStringAction RenameTag { get; set; }
public static EditTagScalarAction EditTagScalar { get; set; }
public static EditByteArrayAction EditByteArray { get; set; }
}
public class TagScalarFormData
{
public TagScalarFormData (TagNode tag)
{
Tag = tag;
}
public TagNode Tag { get; private set; }
}
public class StringFormData
{
public StringFormData (String value)
{
Value = value;
}
public String Value { get; set; }
}
public class RestrictedStringFormData : StringFormData
{
private List<String> _restricted = new List<string>();
public RestrictedStringFormData (String value)
: base(value)
{
}
public List<String> RestrictedValues
{
get { return _restricted; }
}
}
public class ByteArrayFormData
{
public string NodeName { get; set; }
public int BytesPerElement { get; set; }
public byte[] Data { get; set; }
}
}

28
Info.plist Normal file
View file

@ -0,0 +1,28 @@
<?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>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleIconFiles</key>
<array>
<string>dead_bush.icns</string>
</array>
<key>CFBundleIdentifier</key>
<string>jaquadro.NBTExplorer</string>
<key>CFBundleName</key>
<string>NBTExplorer</string>
<key>CFBundleShortVersionString</key>
<string>2.0.3</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

29
Mac/AppDelegate.cs Normal file
View file

@ -0,0 +1,29 @@
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
namespace NBTExplorer
{
public partial class AppDelegate : NSApplicationDelegate
{
MainWindowController mainWindowController;
public AppDelegate ()
{
}
public override void FinishedLaunching (NSObject notification)
{
mainWindowController = new MainWindowController ();
mainWindowController.Window.MakeKeyAndOrderFront (this);
}
partial void ActionRename (NSObject sender)
{
mainWindowController.Window.ActionEditValue();
}
}
}

27
Mac/AppDelegate.designer.cs generated Normal file
View file

@ -0,0 +1,27 @@
// WARNING
//
// This file has been generated automatically by MonoDevelop to store outlets and
// actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using MonoMac.Foundation;
namespace NBTExplorer
{
[Register ("AppDelegate")]
partial class AppDelegate
{
[Action ("ActionRename:")]
partial void ActionRename (MonoMac.Foundation.NSObject sender);
[Action ("ActionEditValue:")]
partial void ActionEditValue (MonoMac.Foundation.NSObject sender);
[Action ("ActionDelete:")]
partial void ActionDelete (MonoMac.Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
}
}
}

158
Mac/EditValue.cs Normal file
View file

@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
using Substrate.Nbt;
namespace NBTExplorer.Mac
{
public partial class EditValue : MonoMac.AppKit.NSWindow
{
public enum DialogResult
{
OK,
Cancel,
}
private TagNode _tag;
private DialogResult _result;
#region Constructors
// Called when created from unmanaged code
public EditValue (IntPtr handle) : base (handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public EditValue (NSCoder coder) : base (coder)
{
Initialize ();
}
public EditValue (TagNode tag)
{
Initialize ();
_tag = tag;
if (tag == null) {
_result = DialogResult.Cancel;
Close();
return;
}
_valueField.StringValue = _tag.ToString();
}
// Shared initialization code
void Initialize ()
{
}
#endregion
public TagNode NodeTag
{
get { return _tag; }
}
public DialogResult Result
{
get { return _result; }
}
/*private TagNode _tag;
public EditValue (TagNode tag)
{
InitializeComponent();
_tag = tag;
if (tag == null) {
DialogResult = DialogResult.Abort;
Close();
return;
}
textBox1.Text = _tag.ToString();
}
public TagNode NodeTag
{
get { return _tag; }
}
private void Apply ()
{
if (ValidateInput()) {
DialogResult = DialogResult.OK;
Close();
}
}
private bool ValidateInput ()
{
return ValidateValueInput();
}
private bool ValidateValueInput ()
{
try {
switch (_tag.GetTagType()) {
case TagType.TAG_BYTE:
_tag.ToTagByte().Data = unchecked((byte)sbyte.Parse(textBox1.Text));
break;
case TagType.TAG_SHORT:
_tag.ToTagShort().Data = short.Parse(textBox1.Text);
break;
case TagType.TAG_INT:
_tag.ToTagInt().Data = int.Parse(textBox1.Text);
break;
case TagType.TAG_LONG:
_tag.ToTagLong().Data = long.Parse(textBox1.Text);
break;
case TagType.TAG_FLOAT:
_tag.ToTagFloat().Data = float.Parse(textBox1.Text);
break;
case TagType.TAG_DOUBLE:
_tag.ToTagDouble().Data = double.Parse(textBox1.Text);
break;
case TagType.TAG_STRING:
_tag.ToTagString().Data = textBox1.Text;
break;
}
}
catch (FormatException) {
MessageBox.Show("The value is formatted incorrectly for the given type.");
return false;
}
catch (OverflowException) {
MessageBox.Show("The value is outside the acceptable range for the given type.");
return false;
}
catch {
return false;
}
return true;
}
private void _buttonOK_Click (object sender, EventArgs e)
{
Apply();
}*/
}
}

31
Mac/EditValue.designer.cs generated Normal file
View file

@ -0,0 +1,31 @@
// WARNING
//
// This file has been generated automatically by MonoDevelop to store outlets and
// actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using MonoMac.Foundation;
namespace NBTExplorer.Mac
{
[Register ("EditValue")]
partial class EditValue
{
[Outlet]
MonoMac.AppKit.NSTextField _valueField { get; set; }
[Action ("ActionOK:")]
partial void ActionOK (MonoMac.Foundation.NSObject sender);
[Action ("ActionCancel:")]
partial void ActionCancel (MonoMac.Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (_valueField != null) {
_valueField.Dispose ();
_valueField = null;
}
}
}
}

390
Mac/EditValue.xib Normal file
View file

@ -0,0 +1,390 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12B2080</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.AppKitVersion">1187</string>
<string key="IBDocument.HIToolboxVersion">624.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2844</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSButton</string>
<string>NSButtonCell</string>
<string>NSCustomObject</string>
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">EditValue</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="661050917">
<int key="NSWindowStyleMask">3</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 86}, {262, 91}}</string>
<int key="NSWTFlags">611844096</int>
<string key="NSWindowTitle">Edit Value...</string>
<string key="NSWindowClass">EditValue</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="1068206745">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTextField" id="922648809">
<reference key="NSNextResponder" ref="1068206745"/>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{20, 49}, {222, 22}}</string>
<reference key="NSSuperview" ref="1068206745"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="321744782">
<int key="NSCellFlags">-1804599231</int>
<int key="NSCellFlags2">272630848</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="1011941154">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="922648809"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="134334418">
<reference key="NSNextResponder" ref="1068206745"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{166, 13}, {82, 32}}</string>
<reference key="NSSuperview" ref="1068206745"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="524484320">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">OK</string>
<reference key="NSSupport" ref="1011941154"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="134334418"/>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSButton" id="862679276">
<reference key="NSNextResponder" ref="1068206745"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{84, 13}, {82, 32}}</string>
<reference key="NSSuperview" ref="1068206745"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="980603739">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Cancel</string>
<reference key="NSSupport" ref="1011941154"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="862679276"/>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</object>
<string key="NSFrameSize">{262, 91}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1600, 1178}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_valueField</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="922648809"/>
</object>
<int key="connectionID">9</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionOK:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="134334418"/>
</object>
<int key="connectionID">10</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionCancel:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="862679276"/>
</object>
<int key="connectionID">11</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="661050917"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1068206745"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="1068206745"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="922648809"/>
<reference ref="134334418"/>
<reference ref="862679276"/>
</object>
<reference key="parent" ref="661050917"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="922648809"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="321744782"/>
</object>
<reference key="parent" ref="1068206745"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="321744782"/>
<reference key="parent" ref="922648809"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="134334418"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="524484320"/>
</object>
<reference key="parent" ref="1068206745"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="524484320"/>
<reference key="parent" ref="134334418"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="862679276"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="980603739"/>
</object>
<reference key="parent" ref="1068206745"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="980603739"/>
<reference key="parent" ref="862679276"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>1.IBPluginDependency</string>
<string>1.IBWindowTemplateEditedContentRect</string>
<string>1.NSWindowTemplate.visibleAtLaunch</string>
<string>2.IBPluginDependency</string>
<string>3.IBPluginDependency</string>
<string>4.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
<string>7.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{361, 348}, {602, 342}}</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">11</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">EditValue</string>
<string key="superclassName">NSWindow</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActionCancel:</string>
<string>ActionOK:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActionCancel:</string>
<string>ActionOK:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">ActionCancel:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">ActionOK:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">_valueField</string>
<string key="NS.object.0">NSTextField</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">_valueField</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">_valueField</string>
<string key="candidateClassName">NSTextField</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/EditValue.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>

32
Mac/IconRegistry.cs Normal file
View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using MonoMac.AppKit;
namespace NBTExplorer.Mac
{
public class IconRegistry
{
private Dictionary<Type, NSImage> _iconRegistry;
public IconRegistry ()
{
_iconRegistry = new Dictionary<Type, NSImage>();
}
public NSImage DefaultIcon { get; set; }
public NSImage Lookup (Type type)
{
if (_iconRegistry.ContainsKey(type))
return _iconRegistry[type];
else
return DefaultIcon;
}
public void Register (Type type, NSImage icon)
{
_iconRegistry[type] = icon;
}
}
}

210
Mac/ImageAndTextCell.cs Normal file
View file

@ -0,0 +1,210 @@
using System;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.CoreGraphics;
using System.Drawing;
using MonoMac.ObjCRuntime;
using System.Collections.Generic;
namespace NBTExplorer.Mac
{
[Register("ImageAndTextCell")]
public class ImageAndTextCell : NSTextFieldCell
{
private NSImage _image;
private bool _copyCalled;
private bool _disposeCalled;
private bool _deallocCalled;
private bool _drawCalled;
public ImageAndTextCell ()
{
}
public ImageAndTextCell (IntPtr handle)
: base(handle)
{
Initialize();
}
// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public ImageAndTextCell (NSCoder coder)
: base (coder)
{
Initialize ();
}
private void Initialize ()
{
LineBreakMode = NSLineBreakMode.TruncatingTail;
Selectable = true;
}
protected override void Dispose (bool disposing)
{
//if (_image != null)
// _image.Dispose();
//if (_noDispose)
// Handle = IntPtr.Zero;
_disposeCalled = true;
base.Dispose (disposing);
}
/*[Export("copyWithZone:")]
public virtual NSObject CopyWithZone(IntPtr zone) {
ImageAndTextCell cell = new ImageAndTextCell() {
Title = Title,
Image = Image,
};
cell._noDispose = true;
return cell;
}*/
static List<ImageAndTextCell> _refPool = new List<ImageAndTextCell>();
//static IntPtr selRetain = Selector.GetHandle ("retain");
//static IntPtr selAutoRelease = Selector.GetHandle("autorelease");
//static IntPtr selRelease = Selector.GetHandle("release");
//static IntPtr selCopyWithZone = Selector.GetHandle("copyWithZone:");
[Export("copyWithZone:")]
public NSObject CopyWithZone (IntPtr zone)
{
//IntPtr copy = Messaging.IntPtr_objc_msgSendSuper_IntPtr(SuperHandle, selCopyWithZone, zone);
//var cloned = new ImageAndTextCell(copy);
//cloned.Title = Title;
//cloned.Image = Image;
var cloned = new ImageAndTextCell {
Title = Title,
Image = Image,
};
cloned._copyCalled = true;
_refPool.Add(cloned);
//Messaging.void_objc_msgSend (cloned.Handle, selRetain);
return cloned;
}
//static IntPtr selDealloc = Selector.GetHandle("dealloc");
[Export("dealloc")]
public void Dealloc ()
{
_deallocCalled = true;
_refPool.Remove(this);
//Messaging.void_objc_msgSendSuper(SuperHandle, selDealloc);
}
public new NSImage Image
{
get { return _image; }
set { _image = value; }
}
public override RectangleF ImageRectForBounds (RectangleF theRect)
{
if (_image != null) {
PointF origin = new PointF(theRect.X + 3, theRect.Y + (float)Math.Ceiling((theRect.Height - _image.Size.Height) / 2));
return new RectangleF(origin, _image.Size);
}
else
return RectangleF.Empty;
}
public override RectangleF TitleRectForBounds (RectangleF theRect)
{
if (_image != null) {
PointF origin = new PointF(theRect.X + 3 + _image.Size.Width, theRect.Y);
SizeF size = new SizeF(theRect.Width - 3 - _image.Size.Width, theRect.Height);
return new RectangleF(origin, size);
}
else
return base.TitleRectForBounds(theRect);
}
public override void EditWithFrame (RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, NSEvent theEvent)
{
RectangleF textFrame, imageFrame;
aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame);
base.EditWithFrame(textFrame, inView, editor, delegateObject, theEvent);
}
public override void SelectWithFrame (RectangleF aRect, NSView inView, NSText editor, NSObject delegateObject, int selStart, int selLength)
{
RectangleF textFrame, imageFrame;
aRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out textFrame);
base.SelectWithFrame(textFrame, inView, editor, delegateObject, selStart, selLength);
}
public override void DrawWithFrame (RectangleF cellFrame, NSView inView)
{
Assert (!_deallocCalled, "DrawWithFrame: Dealloc was called on object");
Assert (!_disposeCalled, "DrawWithFrame: Dispose was called on object");
_drawCalled = true;
if (_image != null) {
RectangleF imageFrame;
cellFrame.Divide (3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out cellFrame);
if (DrawsBackground) {
BackgroundColor.Set ();
NSGraphics.RectFill (imageFrame);
}
imageFrame.X += 3;
imageFrame.Size = _image.Size;
//if (inView.IsFlipped) {
// imageFrame.Y += (float)Math.Ceiling((cellFrame.Height + imageFrame.Height) / 2);
//}
//else {
imageFrame.Y += (float)Math.Ceiling ((cellFrame.Height - imageFrame.Height) / 2);
//}
_image.Draw (imageFrame, new RectangleF (PointF.Empty, _image.Size), NSCompositingOperation.SourceOver, 1f, true, null);
}
base.DrawWithFrame (cellFrame, inView);
}
public override SizeF CellSize
{
get {
if (_image != null)
return new SizeF(base.CellSize.Width + 3 + _image.Size.Width, base.CellSize.Height);
else
return new SizeF(base.CellSize.Width + 3, base.CellSize.Height);
}
}
public override NSCellHit HitTest (NSEvent forEvent, RectangleF inRect, NSView ofView)
{
PointF point = ofView.ConvertPointFromView (forEvent.LocationInWindow, null);
if (_image != null) {
RectangleF imageFrame;
inRect.Divide(3 + _image.Size.Width, CGRectEdge.MinXEdge, out imageFrame, out inRect);
imageFrame.X += 3;
imageFrame.Size = _image.Size;
if (ofView.MouseinRect(point, imageFrame))
return NSCellHit.ContentArea;
}
return base.HitTest (forEvent, inRect, ofView);
}
private void Assert (bool condition, string message)
{
if (!condition)
throw new Exception("Assert failed: " + message);
}
}
}

952
Mac/MainMenu.xib Normal file
View file

@ -0,0 +1,952 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12B2080</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.AppKitVersion">1187</string>
<string key="IBDocument.HIToolboxVersion">624.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2844</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSCustomObject</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="1014">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1050">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSMenu" id="649796088">
<string key="NSTitle">AMainMenu</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="694149608">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">NBTExplorer</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSOnImage" id="35465992">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="502551668">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="110575045">
<string key="NSTitle">NBTExplorer</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="238522557">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">About NBTExplorer</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="304266470">
<reference key="NSMenu" ref="110575045"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="632727374">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">Quit NBTExplorer</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
</object>
<string key="NSName">_NSAppleMenu</string>
</object>
</object>
<object class="NSMenuItem" id="379814623">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">File</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="720053764">
<string key="NSTitle">File</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="722745758">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Open…</string>
<string key="NSKeyEquiv">o</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="827642748">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Open Folder...</string>
<string key="NSKeyEquiv">O</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="692639359">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Open Minecraft Save Folder</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="425164168">
<reference key="NSMenu" ref="720053764"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="1023925487">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Save</string>
<string key="NSKeyEquiv">s</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="101205509">
<reference key="NSMenu" ref="720053764"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="1025936716">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Recent Files</string>
<string key="NSKeyEquiv">R</string>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="1065607017">
<string key="NSTitle">Recent Files</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<string key="NSName">_NSRecentDocumentsMenu</string>
</object>
</object>
<object class="NSMenuItem" id="71035967">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Recent Folders</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="154866312">
<string key="NSTitle">Recent Folders</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="952259628">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">Edit</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="789758025">
<string key="NSTitle">Edit</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="296257095">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Cut</string>
<string key="NSKeyEquiv">x</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="860595796">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Copy</string>
<string key="NSKeyEquiv">c</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="29853731">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Paste</string>
<string key="NSKeyEquiv">v</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="212016141">
<reference key="NSMenu" ref="789758025"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="978707231">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Rename</string>
<string key="NSKeyEquiv">r</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="386478888">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Edit Value</string>
<string key="NSKeyEquiv">e</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="437104165">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Delete</string>
<string key="NSKeyEquiv"></string>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="695807658">
<reference key="NSMenu" ref="789758025"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="713722761">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Find...</string>
<string key="NSKeyEquiv">f</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="406540956">
<reference key="NSMenu" ref="789758025"/>
<string key="NSTitle">Find Next</string>
<string key="NSKeyEquiv"></string>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="586577488">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">View</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="466310130">
<string key="NSTitle">View</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="102151532">
<reference key="NSMenu" ref="466310130"/>
<string key="NSTitle">Show Toolbar</string>
<string key="NSKeyEquiv">t</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="237841660">
<reference key="NSMenu" ref="466310130"/>
<string key="NSTitle">Customize Toolbar…</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="713487014">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">Window</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="448692316">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">Help</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
</object>
<string key="NSName">_NSMainMenu</string>
</object>
<object class="NSCustomObject" id="755631768">
<string key="NSClassName">NSFontManager</string>
</object>
<object class="NSCustomObject" id="947627720">
<string key="NSClassName">AppDelegate</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">terminate:</string>
<reference key="source" ref="1050"/>
<reference key="destination" ref="632727374"/>
</object>
<int key="connectionID">449</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderFrontStandardAboutPanel:</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="238522557"/>
</object>
<int key="connectionID">142</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="947627720"/>
</object>
<int key="connectionID">534</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">copy:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="860595796"/>
</object>
<int key="connectionID">224</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">paste:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="29853731"/>
</object>
<int key="connectionID">226</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">cut:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="296257095"/>
</object>
<int key="connectionID">228</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">saveDocument:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="1023925487"/>
</object>
<int key="connectionID">362</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">runToolbarCustomizationPalette:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="237841660"/>
</object>
<int key="connectionID">365</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleToolbarShown:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="102151532"/>
</object>
<int key="connectionID">366</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">openDocument:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="722745758"/>
</object>
<int key="connectionID">374</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionEditValue:</string>
<reference key="source" ref="947627720"/>
<reference key="destination" ref="386478888"/>
</object>
<int key="connectionID">546</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionRename:</string>
<reference key="source" ref="947627720"/>
<reference key="destination" ref="978707231"/>
</object>
<int key="connectionID">547</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionDelete:</string>
<reference key="source" ref="947627720"/>
<reference key="destination" ref="437104165"/>
</object>
<int key="connectionID">548</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1048"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1021"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1014"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1050"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="649796088"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="713487014"/>
<reference ref="694149608"/>
<reference ref="952259628"/>
<reference ref="379814623"/>
<reference ref="586577488"/>
<reference ref="448692316"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">19</int>
<reference key="object" ref="713487014"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">56</int>
<reference key="object" ref="694149608"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="110575045"/>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">217</int>
<reference key="object" ref="952259628"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="789758025"/>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">83</int>
<reference key="object" ref="379814623"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="720053764"/>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">81</int>
<reference key="object" ref="720053764"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1023925487"/>
<reference ref="722745758"/>
<reference ref="425164168"/>
<reference ref="827642748"/>
<reference ref="1025936716"/>
<reference ref="101205509"/>
<reference ref="71035967"/>
<reference ref="692639359"/>
</object>
<reference key="parent" ref="379814623"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">75</int>
<reference key="object" ref="1023925487"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">72</int>
<reference key="object" ref="722745758"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">124</int>
<reference key="object" ref="1025936716"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1065607017"/>
</object>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">79</int>
<reference key="object" ref="425164168"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">125</int>
<reference key="object" ref="1065607017"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="1025936716"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">205</int>
<reference key="object" ref="789758025"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="437104165"/>
<reference ref="296257095"/>
<reference ref="29853731"/>
<reference ref="860595796"/>
<reference ref="212016141"/>
<reference ref="978707231"/>
<reference ref="386478888"/>
<reference ref="695807658"/>
<reference ref="713722761"/>
<reference ref="406540956"/>
</object>
<reference key="parent" ref="952259628"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">202</int>
<reference key="object" ref="437104165"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">214</int>
<reference key="object" ref="212016141"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">199</int>
<reference key="object" ref="296257095"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">203</int>
<reference key="object" ref="29853731"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">197</int>
<reference key="object" ref="860595796"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">57</int>
<reference key="object" ref="110575045"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="238522557"/>
<reference ref="632727374"/>
<reference ref="304266470"/>
</object>
<reference key="parent" ref="694149608"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">58</int>
<reference key="object" ref="238522557"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">136</int>
<reference key="object" ref="632727374"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">236</int>
<reference key="object" ref="304266470"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">295</int>
<reference key="object" ref="586577488"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="466310130"/>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">296</int>
<reference key="object" ref="466310130"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="102151532"/>
<reference ref="237841660"/>
</object>
<reference key="parent" ref="586577488"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">297</int>
<reference key="object" ref="102151532"/>
<reference key="parent" ref="466310130"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">298</int>
<reference key="object" ref="237841660"/>
<reference key="parent" ref="466310130"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">420</int>
<reference key="object" ref="755631768"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">490</int>
<reference key="object" ref="448692316"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">533</int>
<reference key="object" ref="947627720"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">535</int>
<reference key="object" ref="978707231"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">536</int>
<reference key="object" ref="386478888"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">537</int>
<reference key="object" ref="827642748"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">538</int>
<reference key="object" ref="101205509"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">539</int>
<reference key="object" ref="71035967"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="154866312"/>
</object>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">540</int>
<reference key="object" ref="154866312"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="71035967"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">542</int>
<reference key="object" ref="692639359"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">543</int>
<reference key="object" ref="695807658"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">544</int>
<reference key="object" ref="713722761"/>
<reference key="parent" ref="789758025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">545</int>
<reference key="object" ref="406540956"/>
<reference key="parent" ref="789758025"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>124.IBPluginDependency</string>
<string>125.IBPluginDependency</string>
<string>136.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
<string>197.IBPluginDependency</string>
<string>199.IBPluginDependency</string>
<string>202.IBPluginDependency</string>
<string>203.IBPluginDependency</string>
<string>205.IBPluginDependency</string>
<string>214.IBPluginDependency</string>
<string>217.IBPluginDependency</string>
<string>236.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>295.IBPluginDependency</string>
<string>296.IBPluginDependency</string>
<string>297.IBPluginDependency</string>
<string>298.IBPluginDependency</string>
<string>420.IBPluginDependency</string>
<string>490.IBPluginDependency</string>
<string>533.IBPluginDependency</string>
<string>535.IBPluginDependency</string>
<string>536.IBPluginDependency</string>
<string>537.IBPluginDependency</string>
<string>538.IBPluginDependency</string>
<string>539.IBPluginDependency</string>
<string>540.IBPluginDependency</string>
<string>542.IBPluginDependency</string>
<string>543.IBPluginDependency</string>
<string>544.IBPluginDependency</string>
<string>545.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>57.IBPluginDependency</string>
<string>58.IBPluginDependency</string>
<string>72.IBPluginDependency</string>
<string>75.IBPluginDependency</string>
<string>79.IBPluginDependency</string>
<string>81.IBPluginDependency</string>
<string>83.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">548</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActionDelete:</string>
<string>ActionEditValue:</string>
<string>ActionRename:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActionDelete:</string>
<string>ActionEditValue:</string>
<string>ActionRename:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">ActionDelete:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">ActionEditValue:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">ActionRename:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AppDelegate.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{11, 11}</string>
<string>{10, 3}</string>
</object>
</object>
</data>
</archive>

318
Mac/MainWindow.cs Normal file
View file

@ -0,0 +1,318 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
using NBTExplorer.Mac;
using System.IO;
using NBTExplorer.Model;
namespace NBTExplorer
{
public partial class MainWindow : MonoMac.AppKit.NSWindow
{
#region Constructors
// Called when created from unmanaged code
public MainWindow (IntPtr handle) : base (handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public MainWindow (NSCoder coder) : base (coder)
{
Initialize ();
}
// Shared initialization code
void Initialize ()
{
InitializeIconRegistry();
}
private NBTExplorer.Mac.IconRegistry _iconRegistry;
private void InitializeIconRegistry ()
{
_iconRegistry = new NBTExplorer.Mac.IconRegistry();
_iconRegistry.DefaultIcon = NSImage.ImageNamed("question-white.png");
_iconRegistry.Register(typeof(TagByteDataNode), NSImage.ImageNamed("document-attribute-b.png"));
_iconRegistry.Register(typeof(TagShortDataNode), NSImage.ImageNamed("document-attribute-s.png"));
_iconRegistry.Register(typeof(TagIntDataNode), NSImage.ImageNamed("document-attribute-i.png"));
_iconRegistry.Register(typeof(TagLongDataNode), NSImage.ImageNamed("document-attribute-l.png"));
_iconRegistry.Register(typeof(TagFloatDataNode), NSImage.ImageNamed("document-attribute-f.png"));
_iconRegistry.Register(typeof(TagDoubleDataNode), NSImage.ImageNamed("document-attribute-d.png"));
_iconRegistry.Register(typeof(TagByteArrayDataNode), NSImage.ImageNamed("edit-code.png"));
_iconRegistry.Register(typeof(TagStringDataNode), NSImage.ImageNamed("edit-small-caps.png"));
_iconRegistry.Register(typeof(TagListDataNode), NSImage.ImageNamed("edit-list.png"));
_iconRegistry.Register(typeof(TagCompoundDataNode), NSImage.ImageNamed("box.png"));
_iconRegistry.Register(typeof(RegionChunkDataNode), NSImage.ImageNamed("wooden-box.png"));
_iconRegistry.Register(typeof(DirectoryDataNode), NSImage.ImageNamed("folder-open"));
_iconRegistry.Register(typeof(RegionFileDataNode), NSImage.ImageNamed("block.png"));
_iconRegistry.Register(typeof(CubicRegionDataNode), NSImage.ImageNamed("block.png"));
_iconRegistry.Register(typeof(NbtFileDataNode), NSImage.ImageNamed("wooden-box.png"));
_iconRegistry.Register(typeof(TagIntArrayDataNode), NSImage.ImageNamed("edit-code-i.png"));
}
#endregion
private TreeDataSource _dataSource;
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
_dataSource = new TreeDataSource();
_mainOutlineView.DataSource = _dataSource;
_mainOutlineView.Delegate = new MyDelegate(this);
string[] args = Environment.GetCommandLineArgs();
if (args.Length > 2) {
string[] paths = new string[args.Length - 1];
Array.Copy(args, 1, paths, 0, paths.Length);
OpenPaths(paths);
}
else {
OpenMinecraftDirectory();
}
}
public class MyDelegate : NSOutlineViewDelegate
{
private MainWindow _main;
public MyDelegate (MainWindow main)
{
_main = main;
}
public override void ItemWillExpand (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
Console.WriteLine ("Preparing to expand: " + node.Data.NodeDisplay);
_main.ExpandNode(node);
}
}
public override void ItemDidExpand (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
Console.WriteLine("Finished Expanding: " + node.Data.NodeDisplay);
}
}
public override void ItemWillCollapse (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
if (node.Data.NodeDisplay == "saves") // The root node
Console.WriteLine ("Uh-oh...");
Console.WriteLine("Preparing to collapse: " + node.Data.NodeDisplay);
}
}
public override void ItemDidCollapse (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
_main.CollapseNode(node);
}
}
public override void WillDisplayCell (NSOutlineView outlineView, NSObject cell, NSTableColumn tableColumn, NSObject item)
{
ImageAndTextCell c = cell as ImageAndTextCell;
TreeDataNode node = item as TreeDataNode;
c.Title = node.CombinedName;
c.Image = _main._iconRegistry.Lookup(node.Data.GetType());
//c.StringValue = node.Name;
//throw new System.NotImplementedException ();
}
}
#region Actions
partial void ActionOpenFolder (MonoMac.Foundation.NSObject sender)
{
OpenFolder ();
}
#endregion
private string _openFolderPath = null;
private void OpenFolder ()
{
NSOpenPanel opanel = new NSOpenPanel ();
opanel.CanChooseDirectories = true;
opanel.CanChooseFiles = false;
if (_openFolderPath != null)
opanel.DirectoryUrl = new NSUrl (_openFolderPath, true);
if (opanel.RunModal () == (int)NSPanelButtonType.Ok) {
_openFolderPath = opanel.DirectoryUrl.AbsoluteString;
OpenPaths(new string[] { opanel.DirectoryUrl.Path });
}
//UpdateUI();
}
private void OpenMinecraftDirectory ()
{
try {
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
path = Path.Combine(path, "Library", "Application Support");
path = Path.Combine(path, "minecraft", "saves");
if (!Directory.Exists(path)) {
path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
OpenPaths(new string[] { path });
}
catch (Exception e) {
//NSAlert.WithMessage("Could not open default Minecraft save directory", "OK", null, null, null).RunModal();
Console.WriteLine(e.Message);
try {
OpenPaths(new string[] { Directory.GetCurrentDirectory() });
}
catch (Exception) {
//MessageBox.Show("Could not open current directory, this tool is probably not compatible with your platform.");
Console.WriteLine(e.Message);
NSApplication.SharedApplication.Terminate(this);
}
}
//UpdateUI();
}
private void OpenPaths (string[] paths)
{
_dataSource.Nodes.Clear ();
_mainOutlineView.ReloadData ();
foreach (string path in paths) {
if (Directory.Exists (path)) {
DirectoryDataNode node = new DirectoryDataNode (path);
_dataSource.Nodes.Add (new TreeDataNode (node));
// AddPathToHistory(Settings.Default.RecentDirectories, path);
} else if (File.Exists (path)) {
DataNode node = null;
}
}
if (_dataSource.Nodes.Count > 0) {
_mainOutlineView.ExpandItem(_dataSource.Nodes[0]);
}
_mainOutlineView.ReloadData();
// UpdateUI();
// UpdateOpenMenu();
/*_nodeTree.Nodes.Clear();
foreach (string path in paths) {
if (Directory.Exists(path)) {
DirectoryDataNode node = new DirectoryDataNode(path);
_nodeTree.Nodes.Add(CreateUnexpandedNode(node));
AddPathToHistory(Settings.Default.RecentDirectories, path);
}
else if (File.Exists(path)) {
DataNode node = null;
foreach (var item in FileTypeRegistry.RegisteredTypes) {
if (item.Value.NamePatternTest(path))
node = item.Value.NodeCreate(path);
}
if (node != null) {
_nodeTree.Nodes.Add(CreateUnexpandedNode(node));
AddPathToHistory(Settings.Default.RecentFiles, path);
}
}
}
if (_nodeTree.Nodes.Count > 0) {
_nodeTree.Nodes[0].Expand();
}
UpdateUI();
UpdateOpenMenu();*/
}
private void ExpandNode (TreeDataNode node)
{
if (node == null || node.IsExpanded)
return;
Console.WriteLine ("Expand Node: " + node.Data.NodeDisplay);
node.IsExpanded = true;
node.Nodes.Clear ();
DataNode backNode = node.Data;
if (!backNode.IsExpanded) {
backNode.Expand ();
}
foreach (DataNode child in backNode.Nodes) {
if (child != null) {
node.Nodes.Add (new TreeDataNode (child));
}
}
}
private void CollapseNode (TreeDataNode node)
{
if (node == null || !node.IsExpanded)
return;
/*Console.WriteLine("Collapse Node: " + node.Data.NodeDisplay);
DataNode backNode = node.Data;
if (backNode.IsModified)
return;
backNode.Collapse();
node.IsExpanded = false;
node.Nodes.Clear();*/
}
public void ActionEditValue ()
{
TreeDataNode node = _mainOutlineView.ItemAtRow(_mainOutlineView.SelectedRow) as TreeDataNode;
if (node != null)
EditNode(node);
}
private void EditNode (TreeDataNode node)
{
if (node == null)
return;
if (!node.Data.CanEditNode)
return;
//NBTExplorer.Mac.EditValue form = new NBTExplorer.Mac.EditValue(node.Data);
//if (node.Data.EditNode()) {
//node.Text = dataNode.NodeDisplay;
//UpdateUI(dataNode);
//}
}
}
}

72
Mac/MainWindow.designer.cs generated Normal file
View file

@ -0,0 +1,72 @@
// WARNING
//
// This file has been generated automatically by MonoDevelop to store outlets and
// actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using MonoMac.Foundation;
namespace NBTExplorer
{
[Register ("MainWindow")]
partial class MainWindow
{
[Outlet]
MonoMac.AppKit.NSToolbar _toolbar { get; set; }
[Outlet]
MonoMac.AppKit.NSToolbarItem _toolbarOpenFolder { get; set; }
[Outlet]
MonoMac.AppKit.NSToolbarItem _toolbarSave { get; set; }
[Outlet]
MonoMac.AppKit.NSScrollView _mainScrollView { get; set; }
[Outlet]
MonoMac.AppKit.NSOutlineView _mainOutlineView { get; set; }
[Action ("ActionOpenFolder:")]
partial void ActionOpenFolder (MonoMac.Foundation.NSObject sender);
[Action ("ActionSave:")]
partial void ActionSave (MonoMac.Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (_toolbar != null) {
_toolbar.Dispose ();
_toolbar = null;
}
if (_toolbarOpenFolder != null) {
_toolbarOpenFolder.Dispose ();
_toolbarOpenFolder = null;
}
if (_toolbarSave != null) {
_toolbarSave.Dispose ();
_toolbarSave = null;
}
if (_mainScrollView != null) {
_mainScrollView.Dispose ();
_mainScrollView = null;
}
if (_mainOutlineView != null) {
_mainOutlineView.Dispose ();
_mainOutlineView = null;
}
}
}
[Register ("MainWindowController")]
partial class MainWindowController
{
void ReleaseDesignerOutlets ()
{
}
}
}

788
Mac/MainWindow.xib Normal file
View file

@ -0,0 +1,788 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12B2080</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.AppKitVersion">1187</string>
<string key="IBDocument.HIToolboxVersion">624.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2844</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBCustomCell</string>
<string>NSCustomObject</string>
<string>NSOutlineView</string>
<string>NSScrollView</string>
<string>NSScroller</string>
<string>NSTableColumn</string>
<string>NSToolbar</string>
<string>NSToolbarFlexibleSpaceItem</string>
<string>NSToolbarItem</string>
<string>NSToolbarSpaceItem</string>
<string>NSUserDefaultsController</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">MainWindowController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="748157544">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 74}, {776, 558}}</string>
<int key="NSWTFlags">611844096</int>
<string key="NSWindowTitle">NBTExplorer</string>
<string key="NSWindowClass">MainWindow</string>
<object class="NSToolbar" key="NSViewClass" id="919098349">
<object class="NSMutableString" key="NSToolbarIdentifier">
<characters key="NS.bytes">A9746BAB-CAB3-4A72-9A03-237662FA7440</characters>
</object>
<nil key="NSToolbarDelegate"/>
<bool key="NSToolbarPrefersToBeShown">YES</bool>
<bool key="NSToolbarShowsBaselineSeparator">YES</bool>
<bool key="NSToolbarAllowsUserCustomization">YES</bool>
<bool key="NSToolbarAutosavesConfiguration">YES</bool>
<int key="NSToolbarDisplayMode">1</int>
<int key="NSToolbarSizeMode">2</int>
<object class="NSMutableDictionary" key="NSToolbarIBIdentifiedItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>0156226B-2E18-4406-BBE6-7C88F62B4E27</string>
<string>B62CA8DD-7D49-4BF3-B4AB-417078852D8B</string>
<string>NSToolbarFlexibleSpaceItem</string>
<string>NSToolbarSpaceItem</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSToolbarItem" id="994350550">
<object class="NSMutableString" key="NSToolbarItemIdentifier">
<characters key="NS.bytes">0156226B-2E18-4406-BBE6-7C88F62B4E27</characters>
</object>
<string key="NSToolbarItemLabel">Open</string>
<string key="NSToolbarItemPaletteLabel">Open</string>
<string key="NSToolbarItemToolTip"/>
<nil key="NSToolbarItemView"/>
<object class="NSCustomResource" key="NSToolbarItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">folder-open-24</string>
</object>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{0, 0}</string>
<string key="NSToolbarItemMaxSize">{0, 0}</string>
<bool key="NSToolbarItemEnabled">YES</bool>
<bool key="NSToolbarItemAutovalidates">YES</bool>
<int key="NSToolbarItemTag">-1</int>
<bool key="NSToolbarIsUserRemovable">YES</bool>
<int key="NSToolbarItemVisibilityPriority">0</int>
</object>
<object class="NSToolbarItem" id="386220062">
<object class="NSMutableString" key="NSToolbarItemIdentifier">
<characters key="NS.bytes">B62CA8DD-7D49-4BF3-B4AB-417078852D8B</characters>
</object>
<string key="NSToolbarItemLabel">Save</string>
<string key="NSToolbarItemPaletteLabel">Save</string>
<string key="NSToolbarItemToolTip"/>
<nil key="NSToolbarItemView"/>
<object class="NSCustomResource" key="NSToolbarItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">disk-24</string>
</object>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{0, 0}</string>
<string key="NSToolbarItemMaxSize">{0, 0}</string>
<bool key="NSToolbarItemEnabled">YES</bool>
<bool key="NSToolbarItemAutovalidates">YES</bool>
<int key="NSToolbarItemTag">-1</int>
<bool key="NSToolbarIsUserRemovable">YES</bool>
<int key="NSToolbarItemVisibilityPriority">0</int>
</object>
<object class="NSToolbarFlexibleSpaceItem" id="767736573">
<string key="NSToolbarItemIdentifier">NSToolbarFlexibleSpaceItem</string>
<string key="NSToolbarItemLabel"/>
<string key="NSToolbarItemPaletteLabel">Flexible Space</string>
<nil key="NSToolbarItemToolTip"/>
<nil key="NSToolbarItemView"/>
<nil key="NSToolbarItemImage"/>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{1, 5}</string>
<string key="NSToolbarItemMaxSize">{20000, 32}</string>
<bool key="NSToolbarItemEnabled">YES</bool>
<bool key="NSToolbarItemAutovalidates">YES</bool>
<int key="NSToolbarItemTag">-1</int>
<bool key="NSToolbarIsUserRemovable">YES</bool>
<int key="NSToolbarItemVisibilityPriority">0</int>
<object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSOnImage" id="295458021">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="707498796">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
</object>
</object>
<object class="NSToolbarSpaceItem" id="367445820">
<string key="NSToolbarItemIdentifier">NSToolbarSpaceItem</string>
<string key="NSToolbarItemLabel"/>
<string key="NSToolbarItemPaletteLabel">Space</string>
<nil key="NSToolbarItemToolTip"/>
<nil key="NSToolbarItemView"/>
<nil key="NSToolbarItemImage"/>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{32, 5}</string>
<string key="NSToolbarItemMaxSize">{32, 32}</string>
<bool key="NSToolbarItemEnabled">YES</bool>
<bool key="NSToolbarItemAutovalidates">YES</bool>
<int key="NSToolbarItemTag">-1</int>
<bool key="NSToolbarIsUserRemovable">YES</bool>
<int key="NSToolbarItemVisibilityPriority">0</int>
<object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="295458021"/>
<reference key="NSMixedImage" ref="707498796"/>
</object>
</object>
</object>
</object>
<object class="NSArray" key="NSToolbarIBAllowedItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="367445820"/>
<reference ref="767736573"/>
<reference ref="994350550"/>
<reference ref="386220062"/>
</object>
<object class="NSArray" key="NSToolbarIBDefaultItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="994350550"/>
<reference ref="386220062"/>
<reference ref="767736573"/>
</object>
<object class="NSArray" key="NSToolbarIBSelectableItems" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="312036702">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSScrollView" id="595155248">
<reference key="NSNextResponder" ref="312036702"/>
<int key="NSvFlags">286</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSClipView" id="704700639">
<reference key="NSNextResponder" ref="595155248"/>
<int key="NSvFlags">2304</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSOutlineView" id="26648463">
<reference key="NSNextResponder" ref="704700639"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<string key="NSFrameSize">{776, 558}</string>
<reference key="NSSuperview" ref="704700639"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="720194609"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
<nil key="NSNextResponder"/>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 0}, {16, 17}}</string>
<reference key="NSNextKeyView" ref="704700639"/>
<string key="NSReuseIdentifierKey">_NS:18</string>
</object>
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTableColumn" id="728960727">
<double key="NSWidth">773</double>
<double key="NSMinWidth">16</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75497536</int>
<int key="NSCellFlags2">2048</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double>
<int key="NSfFlags">3100</int>
</object>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">headerTextColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
<object class="IBCustomCell" key="NSDataCell" id="925144048">
<int key="NSCellFlags">0</int>
<int key="NSCellFlags2">0</int>
<reference key="NSControlView" ref="26648463"/>
</object>
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<bool key="NSIsEditable">YES</bool>
<reference key="NSTableView" ref="26648463"/>
</object>
</object>
<double key="NSIntercellSpacingWidth">3</double>
<double key="NSIntercellSpacingHeight">2</double>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="NSGridColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">gridColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<double key="NSRowHeight">17</double>
<int key="NSTvFlags">306184192</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
<int key="NSColumnAutoresizingStyle">0</int>
<int key="NSDraggingSourceMaskForLocal">15</int>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
<int key="NSTableViewDraggingDestinationStyle">0</int>
<int key="NSTableViewGroupRowStyle">1</int>
</object>
</object>
<string key="NSFrame">{{1, 1}, {776, 558}}</string>
<reference key="NSSuperview" ref="595155248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="26648463"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
<reference key="NSDocView" ref="26648463"/>
<object class="NSColor" key="NSBGColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<int key="NScvFlags">4</int>
</object>
<object class="NSScroller" id="720194609">
<reference key="NSNextResponder" ref="595155248"/>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 17}, {15, 102}}</string>
<reference key="NSSuperview" ref="595155248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="927451524"/>
<string key="NSReuseIdentifierKey">_NS:58</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<reference key="NSTarget" ref="595155248"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.99821109123434704</double>
</object>
<object class="NSScroller" id="927451524">
<reference key="NSNextResponder" ref="595155248"/>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 544}, {776, 15}}</string>
<reference key="NSSuperview" ref="595155248"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:60</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="595155248"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.99871299871299868</double>
</object>
</object>
<string key="NSFrame">{{-1, -1}, {778, 560}}</string>
<reference key="NSSuperview" ref="312036702"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="704700639"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<int key="NSsFlags">133682</int>
<reference key="NSVScroller" ref="720194609"/>
<reference key="NSHScroller" ref="927451524"/>
<reference key="NSContentView" ref="704700639"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
<double key="NSMinMagnification">0.25</double>
<double key="NSMaxMagnification">4</double>
<double key="NSMagnification">1</double>
</object>
</object>
<string key="NSFrameSize">{776, 558}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="595155248"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1600, 1178}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSUserDefaultsController" id="28353509">
<bool key="NSSharedInstance">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="748157544"/>
</object>
<int key="connectionID">6</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_mainScrollView</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="595155248"/>
</object>
<int key="connectionID">36</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_mainOutlineView</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="26648463"/>
</object>
<int key="connectionID">37</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_toolbar</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="919098349"/>
</object>
<int key="connectionID">38</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_toolbarOpenFolder</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="994350550"/>
</object>
<int key="connectionID">39</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">_toolbarSave</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="386220062"/>
</object>
<int key="connectionID">40</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionOpenFolder:</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="994350550"/>
</object>
<int key="connectionID">41</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">ActionSave:</string>
<reference key="source" ref="748157544"/>
<reference key="destination" ref="386220062"/>
</object>
<int key="connectionID">42</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="748157544"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="312036702"/>
<reference ref="919098349"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="312036702"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="595155248"/>
</object>
<reference key="parent" ref="748157544"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="919098349"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="367445820"/>
<reference ref="767736573"/>
<reference ref="994350550"/>
<reference ref="386220062"/>
</object>
<reference key="parent" ref="748157544"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="367445820"/>
<reference key="parent" ref="919098349"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">18</int>
<reference key="object" ref="767736573"/>
<reference key="parent" ref="919098349"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">20</int>
<reference key="object" ref="994350550"/>
<reference key="parent" ref="919098349"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
<reference key="object" ref="386220062"/>
<reference key="parent" ref="919098349"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">22</int>
<reference key="object" ref="595155248"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="26648463"/>
<reference ref="927451524"/>
<reference ref="720194609"/>
</object>
<reference key="parent" ref="312036702"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">23</int>
<reference key="object" ref="26648463"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="728960727"/>
</object>
<reference key="parent" ref="595155248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">24</int>
<reference key="object" ref="927451524"/>
<reference key="parent" ref="595155248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">26</int>
<reference key="object" ref="720194609"/>
<reference key="parent" ref="595155248"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">27</int>
<reference key="object" ref="728960727"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="925144048"/>
</object>
<reference key="parent" ref="26648463"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">44</int>
<reference key="object" ref="28353509"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">71</int>
<reference key="object" ref="925144048"/>
<reference key="parent" ref="728960727"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>14.IBPluginDependency</string>
<string>15.IBPluginDependency</string>
<string>18.IBPluginDependency</string>
<string>2.IBPluginDependency</string>
<string>2.IBWindowTemplateEditedContentRect</string>
<string>2.NSWindowTemplate.visibleAtLaunch</string>
<string>20.IBPluginDependency</string>
<string>20.designableToolbarItemIdentifier</string>
<string>21.IBPluginDependency</string>
<string>21.designableToolbarItemIdentifier</string>
<string>22.IBPluginDependency</string>
<string>23.IBPluginDependency</string>
<string>24.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
<string>27.IBPluginDependency</string>
<string>3.IBPluginDependency</string>
<string>44.IBPluginDependency</string>
<string>71.CustomClassName</string>
<string>71.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{319, 371}, {606, 354}}</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>ToolbarOpen</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>ToolbarSave</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>ImageAndTextCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">71</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ImageAndTextCell</string>
<string key="superclassName">NSTextFieldCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ImageAndTextCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MainWindow</string>
<string key="superclassName">NSWindow</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActionOpenFolder:</string>
<string>ActionSave:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ActionOpenFolder:</string>
<string>ActionSave:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">ActionOpenFolder:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">ActionSave:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_mainOutlineView</string>
<string>_mainScrollView</string>
<string>_toolbar</string>
<string>_toolbarOpenFolder</string>
<string>_toolbarSave</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSOutlineView</string>
<string>NSScrollView</string>
<string>NSToolbar</string>
<string>NSToolbarItem</string>
<string>NSToolbarItem</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>_mainOutlineView</string>
<string>_mainScrollView</string>
<string>_toolbar</string>
<string>_toolbarOpenFolder</string>
<string>_toolbarSave</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">_mainOutlineView</string>
<string key="candidateClassName">NSOutlineView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_mainScrollView</string>
<string key="candidateClassName">NSScrollView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_toolbar</string>
<string key="candidateClassName">NSToolbar</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_toolbarOpenFolder</string>
<string key="candidateClassName">NSToolbarItem</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">_toolbarSave</string>
<string key="candidateClassName">NSToolbarItem</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MainWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MainWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MainWindowController.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
<string>disk-24</string>
<string>folder-open-24</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{11, 11}</string>
<string>{10, 3}</string>
<string>{24, 24}</string>
<string>{24, 24}</string>
</object>
</object>
</data>
<classes>
<class name="IBCustomCell">
<fallbacks>
<name>NSCell</name>
</fallbacks>
</class>
</classes>
</archive>

View file

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace NBTExplorer
{
public partial class MainWindowController : MonoMac.AppKit.NSWindowController
{
#region Constructors
// Called when created from unmanaged code
public MainWindowController (IntPtr handle) : base (handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public MainWindowController (NSCoder coder) : base (coder)
{
Initialize ();
}
// Call to load from the XIB/NIB file
public MainWindowController () : base ("MainWindow")
{
Initialize ();
}
// Shared initialization code
void Initialize ()
{
}
#endregion
//strongly typed window accessor
public new MainWindow Window {
get {
return (MainWindow)base.Window;
}
}
}
}

177
Mac/Scratch.cs Normal file
View file

@ -0,0 +1,177 @@
using System;
namespace NBTExplorer.Mac.Test
{
public partial class MainWindow : MonoMac.AppKit.NSWindow
{
// ...
[Outlet]
MonoMac.AppKit.NSOutlineView _mainOutlineView { get; set; }
private TreeDataSource _dataSource;
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
_dataSource = new TreeDataSource();
_mainOutlineView.DataSource = _dataSource;
_mainOutlineView.Delegate = new MyDelegate(this);
}
public class MyDelegate : NSOutlineViewDelegate
{
private MainWindow _main;
public MyDelegate (MainWindow main)
{
_main = main;
}
public override void ItemWillExpand (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
Console.WriteLine ("Preparing to expand: " + node.Data.NodeDisplay);
_main.ExpandNode(node);
}
}
public override void ItemDidExpand (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
Console.WriteLine("Finished Expanding: " + node.Data.NodeDisplay);
}
}
public override void ItemWillCollapse (NSNotification notification)
{
TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode;
if (node != null) {
if (node.Data.NodeDisplay == "saves") // The root node
Console.WriteLine ("Uh-oh...");
Console.WriteLine("Preparing to collapse: " + node.Data.NodeDisplay);
}
}
}
// ...
private void ExpandNode (TreeDataNode node)
{
if (node == null || node.IsExpanded)
return;
Console.WriteLine ("Expand Node: " + node.Data.NodeDisplay);
node.IsExpanded = true;
node.Nodes.Clear ();
DataNode backNode = node.Data;
if (!backNode.IsExpanded) {
backNode.Expand ();
}
foreach (DataNode child in backNode.Nodes) {
if (child != null) {
node.Nodes.Add (new TreeDataNode (child));
}
}
}
}
public class TreeDataSource : NSOutlineViewDataSource
{
private List<TreeDataNode> _nodes;
public TreeDataSource ()
{
_nodes = new List<TreeDataNode>();
}
public List<TreeDataNode> Nodes
{
get { return _nodes; }
}
public override int GetChildrenCount (NSOutlineView outlineView, NSObject item)
{
if (item is TreeDataNode) {
TreeDataNode nodeItem = item as TreeDataNode;
return nodeItem.Nodes.Count;
}
return _nodes.Count;
}
public override NSObject GetObjectValue (NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem)
{
TreeDataNode nodeItem = byItem as TreeDataNode;
if (nodeItem == null)
return null;
return (NSString)nodeItem.CombinedName;
}
public override NSObject GetChild (NSOutlineView outlineView, int childIndex, NSObject ofItem)
{
TreeDataNode nodeItem = ofItem as TreeDataNode;
if (nodeItem != null) {
return nodeItem.Nodes [childIndex];
}
return Nodes[childIndex];
}
public override bool ItemExpandable (NSOutlineView outlineView, NSObject item)
{
TreeDataNode nodeItem = item as TreeDataNode;
if (nodeItem != null)
return nodeItem.HasChildren;
return false;
}
}
public class TreeDataNode : NSObject
{
private DataNode _dataNode;
private List<TreeDataNode> _children;
private bool _expanded;
public TreeDataNode (DataNode node)
{
_dataNode = node;
_children = new List<TreeDataNode>();
}
public DataNode Data
{
get { return _dataNode; }
}
public string CombinedName
{
get { return _dataNode.NodeDisplay; }
}
public bool IsExpanded
{
get { return _expanded; }
set { _expanded = value; }
}
public bool HasChildren
{
get { return _children.Count > 0 || _dataNode.HasUnexpandedChildren; }
}
public List<TreeDataNode> Nodes
{
get { return _children; }
}
}
}

53
Mac/TreeDataNode.cs Normal file
View file

@ -0,0 +1,53 @@
using System;
using MonoMac.Foundation;
using MonoMac.AppKit;
using NBTExplorer.Model;
using System.Collections.Generic;
namespace NBTExplorer.Mac
{
public class TreeDataNode : NSObject
{
private DataNode _dataNode;
private List<TreeDataNode> _children;
private bool _expanded;
public TreeDataNode (DataNode node)
{
_dataNode = node;
_children = new List<TreeDataNode>();
}
public DataNode Data
{
get { return _dataNode; }
}
public string CombinedName
{
get { return _dataNode.NodeDisplay; }
}
public string Name
{
get { return _dataNode.NodeName; }
}
public bool IsExpanded
{
get { return _expanded; }
set { _expanded = value; }
}
public bool HasChildren
{
get { return _children.Count > 0 || _dataNode.HasUnexpandedChildren; }
}
public List<TreeDataNode> Nodes
{
get { return _children; }
}
}
}

61
Mac/TreeDataSource.cs Normal file
View file

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using MonoMac.AppKit;
using MonoMac.Foundation;
namespace NBTExplorer.Mac
{
public class TreeDataSource : NSOutlineViewDataSource
{
private List<TreeDataNode> _nodes;
public TreeDataSource ()
{
_nodes = new List<TreeDataNode>();
}
public List<TreeDataNode> Nodes
{
get { return _nodes; }
}
public override int GetChildrenCount (NSOutlineView outlineView, NSObject item)
{
if (item is TreeDataNode) {
TreeDataNode nodeItem = item as TreeDataNode;
return nodeItem.Nodes.Count;
}
return _nodes.Count;
}
public override NSObject GetObjectValue (NSOutlineView outlineView, NSTableColumn forTableColumn, NSObject byItem)
{
TreeDataNode nodeItem = byItem as TreeDataNode;
if (nodeItem == null)
return null;
return (NSString)nodeItem.CombinedName;
}
public override NSObject GetChild (NSOutlineView outlineView, int childIndex, NSObject ofItem)
{
TreeDataNode nodeItem = ofItem as TreeDataNode;
if (nodeItem != null) {
return nodeItem.Nodes [childIndex];
}
return Nodes[childIndex];
}
public override bool ItemExpandable (NSOutlineView outlineView, NSObject item)
{
TreeDataNode nodeItem = item as TreeDataNode;
if (nodeItem != null)
return nodeItem.HasChildren;
return false;
}
}
}

BIN
MainForm.resources Normal file

Binary file not shown.

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NBTExplorer.Windows;
using Substrate.Nbt;
namespace NBTExplorer.Model

View file

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
//susing System.Windows.Forms;
using Substrate.Nbt;
namespace NBTExplorer.Model
@ -221,11 +221,12 @@ namespace NBTExplorer.Model
public override bool RenameNode ()
{
if (CanRenameNode && TagParent.IsNamedContainer) {
EditName form = new EditName(TagParent.NamedTagContainer.GetTagName(Tag));
form.InvalidNames.AddRange(TagParent.NamedTagContainer.TagNamesInUse);
if (form.ShowDialog() == DialogResult.OK && form.IsModified) {
if (TagParent.NamedTagContainer.RenameTag(Tag, form.TagName)) {
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)) {
IsModified = true;
return true;
}
@ -284,61 +285,77 @@ namespace NBTExplorer.Model
protected bool EditScalarValue (TagNode tag)
{
EditValue form = new EditValue(tag);
if (form.ShowDialog() == DialogResult.OK) {
IsModified = true;
return true;
if (FormRegistry.EditTagScalar != null) {
if (FormRegistry.EditTagScalar(new TagScalarFormData(tag))) {
IsModified = true;
return true;
}
}
else
return false;
return false;
}
protected bool EditStringValue (TagNode tag)
{
EditString form = new EditString(tag.ToTagString().Data);
if (form.ShowDialog() == DialogResult.OK) {
tag.ToTagString().Data = form.StringValue;
IsModified = true;
return true;
if (FormRegistry.EditString != null) {
StringFormData data = new StringFormData(tag.ToTagString().Data);
if (FormRegistry.EditString(data)) {
tag.ToTagString().Data = data.Value;
IsModified = true;
return true;
}
}
else
return false;
return false;
}
protected bool EditByteHexValue (TagNode tag)
{
HexEditor form = new HexEditor(NodeName, tag.ToTagByteArray().Data, 1);
if (form.ShowDialog() == DialogResult.OK && form.Modified) {
Array.Copy(form.Data, tag.ToTagByteArray().Data, tag.ToTagByteArray().Length);
if (FormRegistry.EditByteArray != null) {
byte[] byteData = new byte[tag.ToTagByteArray().Length];
Array.Copy(tag.ToTagByteArray().Data, byteData, byteData.Length);
IsModified = true;
return true;
ByteArrayFormData data = new ByteArrayFormData() {
NodeName = NodeName,
BytesPerElement = 1,
Data = byteData,
};
if (FormRegistry.EditByteArray(data)) {
Array.Copy(data.Data, tag.ToTagByteArray().Data, tag.ToTagByteArray().Length);
IsModified = true;
return true;
}
}
else
return false;
return false;
}
protected bool EditIntHexValue (TagNode tag)
{
TagNodeIntArray iatag = tag.ToTagIntArray();
byte[] data = new byte[iatag.Length * 4];
for (int i = 0; i < iatag.Length; i++) {
byte[] buf = BitConverter.GetBytes(iatag.Data[i]);
Array.Copy(buf, 0, data, 4 * i, 4);
}
HexEditor form = new HexEditor(NodeName, data, 4);
if (form.ShowDialog() == DialogResult.OK && form.Modified) {
if (FormRegistry.EditByteArray != null) {
TagNodeIntArray iatag = tag.ToTagIntArray();
byte[] byteData = new byte[iatag.Length * 4];
for (int i = 0; i < iatag.Length; i++) {
iatag.Data[i] = BitConverter.ToInt32(form.Data, i * 4);
byte[] buf = BitConverter.GetBytes(iatag.Data[i]);
Array.Copy(buf, 0, byteData, 4 * i, 4);
}
IsModified = true;
return true;
ByteArrayFormData data = new ByteArrayFormData() {
NodeName = NodeName,
BytesPerElement = 4,
Data = byteData,
};
if (FormRegistry.EditByteArray(data)) {
for (int i = 0; i < iatag.Length; i++) {
iatag.Data[i] = BitConverter.ToInt32(data.Data, i * 4);
}
IsModified = true;
return true;
}
}
else
return false;
return false;
}
}
}

View file

@ -1,7 +1,7 @@
using System;
using Substrate.Nbt;
namespace NBTExplorer
namespace NBTExplorer.Model
{
public class TagKey : IComparable<TagKey>
{

View file

@ -58,6 +58,7 @@
<DefineConstants>TRACE</DefineConstants>
<Optimize>True</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Release\NBTExplorer.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
@ -79,60 +80,60 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Forms\CancelSearchForm.cs">
<Compile Include="FormRegistry.cs" />
<Compile Include="Windows\CancelSearchForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\CancelSearchForm.Designer.cs">
<Compile Include="Windows\CancelSearchForm.Designer.cs">
<DependentUpon>CancelSearchForm.cs</DependentUpon>
</Compile>
<Compile Include="IconRegistry.cs" />
<Compile Include="MainForm.cs">
<Compile Include="Windows\IconRegistry.cs" />
<Compile Include="Windows\MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<Compile Include="Windows\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="DataNode.cs" />
<Compile Include="Forms\About.cs">
<Compile Include="Windows\About.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\About.Designer.cs">
<Compile Include="Windows\About.Designer.cs">
<DependentUpon>About.cs</DependentUpon>
</Compile>
<Compile Include="Forms\EditName.cs">
<Compile Include="Windows\EditName.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\EditName.Designer.cs">
<Compile Include="Windows\EditName.Designer.cs">
<DependentUpon>EditName.cs</DependentUpon>
</Compile>
<Compile Include="Forms\EditString.cs">
<Compile Include="Windows\EditString.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\EditString.Designer.cs">
<Compile Include="Windows\EditString.Designer.cs">
<DependentUpon>EditString.cs</DependentUpon>
</Compile>
<Compile Include="Forms\CreateNode.cs">
<Compile Include="Windows\CreateNode.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\CreateNode.Designer.cs">
<Compile Include="Windows\CreateNode.Designer.cs">
<DependentUpon>CreateNode.cs</DependentUpon>
</Compile>
<Compile Include="Forms\EditValue.cs">
<Compile Include="Windows\EditValue.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\EditValue.Designer.cs">
<Compile Include="Windows\EditValue.Designer.cs">
<DependentUpon>EditValue.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Find.cs">
<Compile Include="Windows\Find.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Find.Designer.cs">
<Compile Include="Windows\Find.Designer.cs">
<DependentUpon>Find.cs</DependentUpon>
</Compile>
<Compile Include="Forms\EditHex.cs">
<Compile Include="Windows\EditHex.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\EditHex.Designer.cs">
<Compile Include="Windows\EditHex.Designer.cs">
<DependentUpon>EditHex.cs</DependentUpon>
</Compile>
<Compile Include="Model\CompoundTagContainer.cs" />
@ -169,6 +170,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>
@ -189,32 +191,33 @@
<Compile Include="Vendor\Be.Windows.Forms.HexBox\MemoryDataBlock.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\NativeMethods.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\Util.cs" />
<EmbeddedResource Include="Forms\CancelSearchForm.resx">
<Compile Include="Windows\FormHandlers.cs" />
<EmbeddedResource Include="Windows\CancelSearchForm.resx">
<DependentUpon>CancelSearchForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<EmbeddedResource Include="Windows\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\About.resx">
<EmbeddedResource Include="Windows\About.resx">
<DependentUpon>About.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\EditName.resx">
<EmbeddedResource Include="Windows\EditName.resx">
<DependentUpon>EditName.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\EditString.resx">
<EmbeddedResource Include="Windows\EditString.resx">
<DependentUpon>EditString.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\CreateNode.resx">
<EmbeddedResource Include="Windows\CreateNode.resx">
<DependentUpon>CreateNode.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\EditValue.resx">
<EmbeddedResource Include="Windows\EditValue.resx">
<DependentUpon>EditValue.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Find.resx">
<EmbeddedResource Include="Windows\Find.resx">
<DependentUpon>Find.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\EditHex.resx">
<EmbeddedResource Include="Windows\EditHex.resx">
<DependentUpon>EditHex.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
@ -233,7 +236,6 @@
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<Compile Include="TagKey.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="dead_bush.ico" />
@ -245,6 +247,7 @@
<None Include="Resources\arrow-270.png" />
<Content Include="Vendor\Be.Windows.Forms.HexBox\HexBox.bmp" />
</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.

View file

@ -3,7 +3,7 @@ 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\NBTExplorerMac.csproj", "{01F9A296-C477-4CBF-A0D0-41E697048257}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBTExplorerMac", "NBTExplorerMac.csproj", "{01F9A296-C477-4CBF-A0D0-41E697048257}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -30,21 +30,23 @@ Global
{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|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Debug|Mixed Platforms.Build.0 = Debug|x86
{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|x86
{8A458245-8176-4599-95CD-3CA39F2435CE}.Release|Mixed Platforms.Build.0 = Release|x86
{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\NBTExplorerMac.csproj
StartupItem = NBTExplorer.csproj
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

226
NBTExplorerMac.csproj Normal file
View file

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{01F9A296-C477-4CBF-A0D0-41E697048257}</ProjectGuid>
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>NBTExplorer</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>NBTExplorer</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnablePackageSigning>False</EnablePackageSigning>
<IncludeMonoRuntime>False</IncludeMonoRuntime>
<ConsolePause>False</ConsolePause>
<EnableCodeSigning>False</EnableCodeSigning>
<CreatePackage>False</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnablePackageSigning>False</EnablePackageSigning>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<LinkMode>Full</LinkMode>
<ConsolePause>False</ConsolePause>
<EnableCodeSigning>False</EnableCodeSigning>
<CreatePackage>False</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<IncludeMonoRuntime>True</IncludeMonoRuntime>
<LinkMode>Full</LinkMode>
<EnablePackageSigning>True</EnablePackageSigning>
<ConsolePause>False</ConsolePause>
<EnableCodeSigning>True</EnableCodeSigning>
<CreatePackage>True</CreatePackage>
<CodeSigningKey>3rd Party Mac Developer Application</CodeSigningKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="Substrate">
<HintPath>..\Substrate\SubstrateCS\bin\Release\NET2\Substrate.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Data" />
<Reference Include="MonoMac, Version=0.0.0.0, Culture=neutral">
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="app.config" />
<None Include="Properties\Resources.resources" />
<None Include="Properties\Resources.resx" />
<None Include="Properties\Settings.settings" />
<None Include="Vendor\Be.Windows.Forms.HexBox\HexBox.bmp" />
<None Include="Vendor\Be.Windows.Forms.HexBox\HexBox.resources" />
<None Include="Vendor\Be.Windows.Forms.HexBox\HexBox.resx" />
<None Include="Vendor\Be.Windows.Forms.HexBox\Properties\Resources.resx" />
<None Include="LICENSE.txt" />
<None Include="dead_bush.icns" />
<None Include="Mac\Scratch.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
<ItemGroup>
<Folder Include="Model\" />
<Folder Include="Properties\" />
<Folder Include="Resources\" />
<Folder Include="Vendor\" />
<Folder Include="Mac\" />
<Folder Include="Resources\24\" />
</ItemGroup>
<ItemGroup>
<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="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs" />
<Compile Include="Properties\Settings.Designer.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\BuiltInContextMenu.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\ByteCharConverters.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\ByteCollection.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\BytePositionInfo.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\DataBlock.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\DataMap.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\DynamicByteProvider.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\DynamicFileByteProvider.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\FileByteProvider.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\FileDataBlock.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\HexBox.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\HexCasing.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\IByteProvider.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\MemoryDataBlock.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\NativeMethods.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\Util.cs" />
<Compile Include="Vendor\Be.Windows.Forms.HexBox\Properties\Resources.Designer.cs" />
<Compile Include="NbtClipboardData.cs" />
<Compile Include="SearchWorker.cs" />
<Compile Include="Mac\MainWindow.cs" />
<Compile Include="Mac\MainWindowController.cs" />
<Compile Include="Mac\MainWindow.designer.cs">
<DependentUpon>MainWindow.cs</DependentUpon>
</Compile>
<Compile Include="Mac\AppDelegate.cs" />
<Compile Include="Mac\AppDelegate.designer.cs">
<DependentUpon>AppDelegate.cs</DependentUpon>
</Compile>
<Compile Include="Mac\TreeDataNode.cs" />
<Compile Include="Mac\TreeDataSource.cs" />
<Compile Include="Mac\ImageAndTextCell.cs" />
<Compile Include="Mac\IconRegistry.cs" />
<Compile Include="Mac\EditValue.cs" />
<Compile Include="Mac\EditValue.designer.cs">
<DependentUpon>EditValue.cs</DependentUpon>
</Compile>
<Compile Include="Model\TagKey.cs" />
<Compile Include="ProgramMac.cs" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Dead_Bush.png" />
<BundleResource Include="Resources\arrow-090.png" />
<BundleResource Include="Resources\arrow-270.png" />
<BundleResource Include="Resources\binocular--arrow.png" />
<BundleResource Include="Resources\binocular.png" />
<BundleResource Include="Resources\clipboard-paste.png" />
<BundleResource Include="Resources\cross.png" />
<BundleResource Include="Resources\disk--pencil.png" />
<BundleResource Include="Resources\disk.png" />
<BundleResource Include="Resources\document-attribute-b.png" />
<BundleResource Include="Resources\document-attribute-i.png" />
<BundleResource Include="Resources\document-copy.png" />
<BundleResource Include="Resources\door.png" />
<BundleResource Include="Resources\edit-code-b.png" />
<BundleResource Include="Resources\edit-code-i.png" />
<BundleResource Include="Resources\edit-code.png" />
<BundleResource Include="Resources\folder-open-document.png" />
<BundleResource Include="Resources\folder-open.png" />
<BundleResource Include="Resources\information-frame.png" />
<BundleResource Include="Resources\pencil.png" />
<BundleResource Include="Resources\question-frame.png" />
<BundleResource Include="Resources\question-white.png" />
<BundleResource Include="Resources\scissors.png" />
<BundleResource Include="Resources\selection-input.png" />
<BundleResource Include="Resources\24\cross.png" />
<BundleResource Include="Resources\24\document-b.png" />
<BundleResource Include="Resources\24\document-d.png" />
<BundleResource Include="Resources\24\document-f.png" />
<BundleResource Include="Resources\24\document-i.png" />
<BundleResource Include="Resources\24\document-l.png" />
<BundleResource Include="Resources\24\document-s.png" />
<BundleResource Include="Resources\24\document.png" />
<BundleResource Include="Resources\24\edit-code-i.png" />
<BundleResource Include="Resources\24\edit-code.png" />
<BundleResource Include="Resources\24\edit-list.png" />
<BundleResource Include="Resources\24\edit-smallcaps.png" />
<BundleResource Include="Resources\24\pencil.png" />
<BundleResource Include="Resources\24\scissors.png" />
<BundleResource Include="Resources\24\selection-input.png" />
<BundleResource Include="Resources\24\box-24.png" />
<BundleResource Include="Resources\folder-open-24.png" />
<BundleResource Include="Resources\disk-24.png" />
<BundleResource Include="Resources\block.png" />
<BundleResource Include="Resources\box.png" />
<BundleResource Include="Resources\document-attribute-d.png" />
<BundleResource Include="Resources\document-attribute-f.png" />
<BundleResource Include="Resources\document-attribute-l.png" />
<BundleResource Include="Resources\document-attribute-s.png" />
<BundleResource Include="Resources\edit-list.png" />
<BundleResource Include="Resources\edit-small-caps.png" />
<BundleResource Include="Resources\wooden-box.png" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Mac\MainWindow.xib" />
<InterfaceDefinition Include="Mac\MainMenu.xib" />
<InterfaceDefinition Include="Mac\EditValue.xib" />
</ItemGroup>
</Project>

View file

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using NBTExplorer.Windows;
namespace NBTExplorer
{

36
ProgramMac.cs Normal file
View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
namespace NBTExplorer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
//[STAThread]
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.Main (args);
}
/*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();
}*/
}
}

Binary file not shown.

BIN
Resources/disk-24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class About
{

View file

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class About : Form
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer.Forms
namespace NBTExplorer.Windows
{
partial class CancelSearchForm
{

View file

@ -0,0 +1,12 @@
using System.Windows.Forms;
namespace NBTExplorer.Windows
{
public partial class CancelSearchForm : Form
{
public CancelSearchForm ()
{
InitializeComponent();
}
}
}

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class CreateNodeForm
{

View file

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Substrate.Nbt;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class CreateNodeForm : Form
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class HexEditor
{

View file

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Be.Windows.Forms;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class HexEditor : Form
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class EditName
{

View file

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Substrate.Nbt;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class EditName : Form
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class EditString
{

View file

@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Substrate.Nbt;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class EditString : Form
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class EditValue
{

View file

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Substrate.Nbt;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class EditValue : Form
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class Find
{

View file

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class Find : Form
{

60
Windows/FormHandlers.cs Normal file
View file

@ -0,0 +1,60 @@
using System;
using System.Windows.Forms;
namespace NBTExplorer.Windows
{
public static class FormHandlers
{
public static void Register ()
{
FormRegistry.EditByteArray = EditByteArrayHandler;
FormRegistry.EditString = EditStringHandler;
FormRegistry.EditTagScalar = EditTagScalarValueHandler;
FormRegistry.RenameTag = RenameTagHandler;
}
public static bool EditStringHandler (StringFormData data)
{
EditString form = new EditString(data.Value);
if (form.ShowDialog() == DialogResult.OK) {
data.Value = form.StringValue;
return true;
}
else
return false;
}
public static bool RenameTagHandler (RestrictedStringFormData data)
{
EditName form = new EditName(data.Value);
form.InvalidNames.AddRange(data.RestrictedValues);
if (form.ShowDialog() == DialogResult.OK && form.IsModified) {
data.Value = form.TagName;
return true;
}
else
return false;
}
public static bool EditTagScalarValueHandler (TagScalarFormData data)
{
EditValue form = new EditValue(data.Tag);
if (form.ShowDialog() == DialogResult.OK)
return true;
else
return false;
}
public static bool EditByteArrayHandler (ByteArrayFormData data)
{
HexEditor form = new HexEditor(data.NodeName, data.Data, data.BytesPerElement);
if (form.ShowDialog() == DialogResult.OK && form.Modified) {
Array.Copy(form.Data, data.Data, data.Data.Length);
return true;
}
else
return false;
}
}
}

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public class IconRegistry
{

View file

@ -1,4 +1,4 @@
namespace NBTExplorer
namespace NBTExplorer.Windows
{
partial class MainForm
{

View file

@ -1,16 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using NBTExplorer.Forms;
using NBTExplorer.Model;
using Substrate.Nbt;
using NBTExplorer.Properties;
using System.Collections.Specialized;
using Substrate.Nbt;
namespace NBTExplorer
namespace NBTExplorer.Windows
{
public partial class MainForm : Form
{
@ -45,6 +44,7 @@ namespace NBTExplorer
{
InitializeComponent();
InitializeIconRegistry();
FormHandlers.Register();
FormClosing += MainForm_Closing;

BIN
dead_bush.icns Normal file

Binary file not shown.

BIN
forms/About.resources Normal file

Binary file not shown.

View file

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace NBTExplorer.Forms
{
public partial class CancelSearchForm : Form
{
public CancelSearchForm ()
{
InitializeComponent();
}
}
}

Binary file not shown.

BIN
forms/CreateNode.resources Normal file

Binary file not shown.

BIN
forms/EditHex.resources Normal file

Binary file not shown.

BIN
forms/EditName.resources Normal file

Binary file not shown.

BIN
forms/EditString.resources Normal file

Binary file not shown.

BIN
forms/EditValue.resources Normal file

Binary file not shown.

BIN
forms/Find.resources Normal file

Binary file not shown.