public override int OffsetOfNode(FileDataNode node) { if (node == this) { return(0); } int offset = GetHeaderSize(); foreach (FileDataNode child in Nodes.OfType <FileDataNode>()) { offset += 0x100; if (child == node) { return(offset); } int childOffset = child.OffsetOfNode(node); if (childOffset != -1) { return(offset + childOffset); } offset += (child.GetSizeInMemory() + 0x3F) & ~0x3F; } return(-1); }
public void Move(int index) { FileDataNode dataParent = FileDataParent; TreeNode nodeParent = Parent; TreeView treeParent = (TreeView.Nodes.Contains(this) ? TreeView : null); index = Math.Max(index, 0); Remove(); if (dataParent != null) { index = Math.Min(index, dataParent.Nodes.Count); dataParent.Insert(index, this); } else if (nodeParent != null) { index = Math.Min(index, nodeParent.Nodes.Count); nodeParent.Nodes.Insert(index, this); } else if (treeParent != null) { index = Math.Min(index, treeParent.Nodes.Count); treeParent.Nodes.Insert(index, this); } }
public virtual int OffsetOfNode(FileDataNode node) { if (node == this) { return(0); } int offset = GetHeaderSize(); foreach (FileDataNode child in Nodes.OfType <FileDataNode>()) { if (child == node) { return(offset); } int childOffset = child.OffsetOfNode(node); if (childOffset != -1) { return(offset + childOffset); } offset += child.GetSizeInMemory(); } return(-1); }
public FileDataNode InsertAbove(string path) { FileDataNode node = FromFile(path); InsertAbove(node); return(node); }
public FileDataNode Insert(int index, string path) { FileDataNode node = FromFile(path); Insert(index, node); return(node); }
public FileDataNode Import(string path) { FileDataNode node = FromFile(path); Import(node); return(node); }
public FileDataNode Replace(string path) { FileDataNode node = FromFile(path); Replace(node); return(node); }
public override void Remove(FileDataNode node) { RmdNode rmdNode = node as RmdNode; if (rmdNode != null) { _Element.Elements.Remove(rmdNode.Element); } base.Remove(node); }
public override void Insert(int index, FileDataNode node) { RmdNode rmdNode = node as RmdNode; if (rmdNode == null) { throw new Exception("Rmd container nodes can only contain other Rmd nodes."); } _ContainerElement.Elements.Insert(index, rmdNode.Element); base.Insert(index, node); }
private void InsertAbove_Click(object sender, EventArgs e) { OpenFileDialog openDlg = new OpenFileDialog(); if (openDlg.ShowDialog() != DialogResult.OK) { return; } FileDataNode node = InsertAbove(openDlg.FileName); if (node != null) { node.TreeView.SelectedNode = node; } }
public void InsertAbove(FileDataNode node) { if (FileDataParent != null) { int index = FileDataParent.Nodes.IndexOf(this); FileDataParent.Insert(index, node); } else if (Parent != null) { int index = Parent.Nodes.IndexOf(this); Parent.Nodes.Insert(index, node); } else if (TreeView != null && TreeView.Nodes.Contains(this)) { int index = TreeView.Nodes.IndexOf(this); TreeView.Nodes.Insert(index, node); } }
private void Replace_Click(object sender, EventArgs e) { OpenFileDialog openDlg = new OpenFileDialog(); if (openDlg.ShowDialog() != DialogResult.OK) { return; } FileDataNode node = Replace(openDlg.FileName); if (node != null) { node.TreeView.SelectedNode = node; if (IsExpanded) { node.Expand(); } } }
public static FileDataNode FromFile(string path, bool simplifyNode) { FileDataNode result = null; if (path.EndsWith(".Rmd", true, CultureInfo.CurrentCulture)) { result = TryFromRmdFile(path, simplifyNode); } else if (path.EndsWith(".Pac", true, CultureInfo.CurrentCulture)) { result = TryFromPacFile(path); } else if (path.EndsWith(".bf", true, CultureInfo.CurrentCulture)) { result = TryFromFlowFile(path); } if (result == null) { result = TryFromRmdFile(path, simplifyNode); } if (result == null) { result = TryFromPacFile(path); } if (result == null) { result = TryFromFlowFile(path); } if (result == null) { result = TryFromRawFileData(path); } return(result); }
public override void Insert(int index, FileDataNode node) { throw new NotImplementedException(); }
public void Import(FileDataNode node) { Insert(Nodes.Count, node); }
public SurrogateDataObject(FileDataNode owner) { _FileDataNode = owner; }
public virtual void Insert(int index, FileDataNode node) { Nodes.Insert(index, node); }
public virtual void Remove(FileDataNode node) { Nodes.Remove(node); }
public void Replace(FileDataNode node) { InsertAbove(node); Remove(); }