NBTExplorer/DataNode.cs

122 lines
2.6 KiB
C#
Raw Normal View History

2012-08-26 21:33:54 +00:00
using Substrate.Core;
using Substrate.Nbt;
2012-08-31 05:29:32 +00:00
using System.Collections.Generic;
using System;
using System.Windows.Forms;
2012-08-26 21:33:54 +00:00
namespace NBTExplorer
{
2012-08-31 05:29:32 +00:00
public class DataNodeOld
2012-08-26 21:33:54 +00:00
{
2012-08-31 05:29:32 +00:00
public DataNodeOld ()
2012-08-26 21:33:54 +00:00
{
}
2012-08-31 05:29:32 +00:00
public DataNodeOld (DataNodeOld parent)
2012-08-26 21:33:54 +00:00
{
Parent = parent;
}
2012-08-31 05:29:32 +00:00
public DataNodeOld Parent { get; set; }
2012-08-26 21:33:54 +00:00
private bool _modified;
public bool Modified
{
get { return _modified; }
set
{
if (value && Parent != null) {
Parent.Modified = value;
}
_modified = value;
}
}
public bool Expanded { get; set; }
}
2012-08-31 05:29:32 +00:00
public class NbtDataNode : DataNodeOld
2012-08-26 21:33:54 +00:00
{
public NbtDataNode ()
{
}
2012-08-31 05:29:32 +00:00
public NbtDataNode (DataNodeOld parent)
2012-08-26 21:33:54 +00:00
: base(parent)
{
}
public NbtTree Tree { get; set; }
}
public class RegionChunkData : NbtDataNode
{
public RegionChunkData (RegionFile file, int x, int z)
: this(null, file, x, z)
{
}
2012-08-31 05:29:32 +00:00
public RegionChunkData (DataNodeOld parent, RegionFile file, int x, int z)
2012-08-26 21:33:54 +00:00
: 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; }
}
2012-08-31 05:29:32 +00:00
public class RegionData : DataNodeOld
2012-08-26 21:33:54 +00:00
{
public RegionData (string path)
: this(null, path)
{
}
2012-08-31 05:29:32 +00:00
public RegionData (DataNodeOld parent, string path)
2012-08-26 21:33:54 +00:00
: base(parent)
{
Path = path;
}
public string Path { get; private set; }
}
public class NbtFileData : NbtDataNode
{
public NbtFileData (string path, CompressionType cztype)
: this(null, path, cztype)
{
}
2012-08-31 05:29:32 +00:00
public NbtFileData (DataNodeOld parent, string path, CompressionType cztype)
2012-08-26 21:33:54 +00:00
: base(parent)
{
Path = path;
CompressionType = cztype;
}
public string Path { get; private set; }
public CompressionType CompressionType { get; private set; }
}
2012-08-31 05:29:32 +00:00
public class DirectoryData : DataNodeOld
2012-08-26 21:33:54 +00:00
{
public DirectoryData (string path)
: this(null, path)
{
}
2012-08-31 05:29:32 +00:00
public DirectoryData (DataNodeOld parent, string path)
2012-08-26 21:33:54 +00:00
: base(parent)
{
Path = path;
}
public string Path { get; private set; }
}
}