mirror of
https://github.com/jaquadro/NBTExplorer.git
synced 2025-01-10 01:46:24 +00:00
NBT files (i.e .dat or .schematic files) can now have their data copied into the clipboard.
This commit is contained in:
parent
15b1b2891f
commit
09f7112164
1 changed files with 42 additions and 0 deletions
|
@ -59,6 +59,7 @@ namespace NBTExplorer.Model
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return NodeCapabilities.CreateTag
|
return NodeCapabilities.CreateTag
|
||||||
|
| NodeCapabilities.Copy
|
||||||
| NodeCapabilities.PasteInto
|
| NodeCapabilities.PasteInto
|
||||||
| NodeCapabilities.Search
|
| NodeCapabilities.Search
|
||||||
| NodeCapabilities.Refresh
|
| NodeCapabilities.Refresh
|
||||||
|
@ -71,11 +72,17 @@ namespace NBTExplorer.Model
|
||||||
get { return Path.GetFileName(_path); }
|
get { return Path.GetFileName(_path); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override string NodePathName
|
public override string NodePathName
|
||||||
{
|
{
|
||||||
get { return Path.GetFileName(_path); }
|
get { return Path.GetFileName(_path); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string NodeNameWithoutExtension
|
||||||
|
{
|
||||||
|
get { return Path.GetFileNameWithoutExtension(_path); }
|
||||||
|
}
|
||||||
|
|
||||||
public override string NodeDisplay
|
public override string NodeDisplay
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -101,6 +108,27 @@ namespace NBTExplorer.Model
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TagNodeCompound GetTagNode ()
|
||||||
|
{
|
||||||
|
TagNode tag;
|
||||||
|
|
||||||
|
if (_tree == null) {
|
||||||
|
try {
|
||||||
|
Expand();
|
||||||
|
tag = _tree.Root.Copy();
|
||||||
|
Release();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Release();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tag = _tree.Root.Copy();
|
||||||
|
}
|
||||||
|
return (TagNodeCompound) tag;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void ExpandCore ()
|
protected override void ExpandCore ()
|
||||||
{
|
{
|
||||||
if (_tree == null) {
|
if (_tree == null) {
|
||||||
|
@ -203,6 +231,20 @@ namespace NBTExplorer.Model
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CopyNode()
|
||||||
|
{
|
||||||
|
if (CanCopyNode)
|
||||||
|
{
|
||||||
|
// Need to create new compound tag, add all children of the nbt node into it,
|
||||||
|
// copy it and delete it.
|
||||||
|
|
||||||
|
NbtClipboardController.CopyToClipboard(new NbtClipboardData(this.NodeNameWithoutExtension, this.GetTagNode()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool PasteNode ()
|
public override bool PasteNode ()
|
||||||
{
|
{
|
||||||
if (!CanPasteIntoNode)
|
if (!CanPasteIntoNode)
|
||||||
|
|
Loading…
Reference in a new issue