private NodeSource SetupUnextractedSource() { DefaultState defaultState = new DefaultState(Resources.cd16); TagArchiveNodeSource source = new TagArchiveNodeSource("Unextracted", currentGame, Core.Prometheus.Instance.DocumentManager, DisplayItems.AllUnextractedItems, defaultState); AddTagViewUnextractedMenus(source); return(source); }
/// <summary> /// Returns a value indicating if the specified NodeInfo contains children. /// </summary> public override bool HasChildren(NodeInfo info) { TagArchiveNodeSource source = (TagArchiveNodeSource)ParentSource; TagPath path = new TagPath(info.Identifier, source.Game.GameID, TagLocation.Archive); TagFile file = Core.Prometheus.Instance.Pool.GetTagFile(path); return(file.Attachments.Length > 0); }
/// <summary> /// Returns an array of NodeInfo entries that exist beneath the specified NodeInfo. /// </summary> public override NodeInfo[] GetChildNodes(NodeInfo info) { List <NodeInfo> children = new List <NodeInfo>(); TagArchiveNodeSource source = (TagArchiveNodeSource)ParentSource; string[] folders = source.Library.GetFolderList(""); foreach (string folder in folders) { FolderNodeType nodeType = source.GetNodeType <FolderNodeType>(); NodeInfo folderInfo = new NodeInfo(nodeType, folder); children.Add(folderInfo); } return(children.ToArray()); }
/// <summary> /// Returns a value indicating if the specified NodeInfo contains children. /// </summary> public override bool HasChildren(NodeInfo info) { TagArchiveNodeSource source = (TagArchiveNodeSource)ParentSource; bool hasChildren = false; if (source.Library.GetFolderList("").Length > 0) { hasChildren = true; } else if (source.Library.GetFileList("").Length > 0) { hasChildren = true; } return(hasChildren); }
private NodeSource SetupMergedSource() { // This is majorly inefficient, but I'm lazy... :D bool unextractedTagsExist = SetupUnextractedSource().ContainsNodes; DefaultState defaultState = new DefaultState(Resources.cabinet16); extractedSource = new TagArchiveNodeSource("Merged", currentGame, Core.Prometheus.Instance.DocumentManager, unextractedTagsExist ? DisplayItems.AllItems : DisplayItems.AllExtractedItems, defaultState); AddTagViewExtractedMenus(extractedSource); if (unextractedTagsExist) { AddTagViewUnextractedMenus(extractedSource); } return(extractedSource); }
/// <summary> /// Returns an array of NodeInfo entries that exist beneath the specified NodeInfo. /// </summary> public override NodeInfo[] GetChildNodes(NodeInfo info) { List <NodeInfo> children = new List <NodeInfo>(); TagArchiveNodeSource source = (TagArchiveNodeSource)ParentSource; TagPath tagPath = new TagPath(info.Identifier, source.Game.GameID, TagLocation.Archive); TagFile file = Core.Prometheus.Instance.Pool.GetTagFile(tagPath); foreach (string attachment in file.Attachments) { NodeInfo attachmentInfo = new NodeInfo(ParentSource.GetNodeType <AttachedScriptNodeType>(), info.Identifier + "|" + attachment); children.Add(attachmentInfo); } return(children.ToArray()); }
/// <summary> /// Returns an array of NodeInfo entries that exist beneath the specified NodeInfo. /// </summary> public override NodeInfo[] GetChildNodes(NodeInfo info) { List <NodeInfo> children = new List <NodeInfo>(); TagArchiveNodeSource source = (TagArchiveNodeSource)ParentSource; string[] folders = source.Library.GetFolderList(info.Identifier); foreach (string folder in folders) { FolderNodeType nodeType = source.GetNodeType <FolderNodeType>(); NodeInfo newInfo = new NodeInfo(nodeType, folder); children.Add(newInfo); } string[] files = source.Library.GetFileList(info.Identifier, "*"); foreach (string file in files) { NodeType nodeType = source.GetNodeType(file); NodeInfo newInfo = new NodeInfo(nodeType, file); children.Add(newInfo); } return(children.ToArray()); }
private void treeView_AfterCheck(object sender, TreeViewEventArgs e) { // We are only worried about nodes of types "unextractedfolder" and unextractedfile". if (!(e.Node is MultiSourceTreeNode)) { return; } MultiSourceTreeNode node = (MultiSourceTreeNode)e.Node; try { Cursor = Cursors.WaitCursor; foreach (NodeInfo entry in node.InfoEntries) { if (entry.NodeType is UnextractedHLTGroupNodeType) { string group = entry.Identifier.Trim('[', ']'); foreach (TypeTableEntry typeEntry in currentGame.TypeTable.GetHighLevelTypes(group)) { string[] files = ((TagArchive)currentGame.GlobalTagLibrary).MissingFilesArchive.GetFileList( "", typeEntry.FullName, true); foreach (string file in files) { if (e.Node.Checked) { AddToQueue(file); } else { RemoveFromQueue(file); } } } } else if (entry.NodeType is UnextractedHLTNodeType) { if (e.Node.Checked) { AddToQueue(entry.Identifier); } else { RemoveFromQueue(entry.Identifier); } } else if (entry.NodeType is UnextractedFolderNodeType) { TagArchiveNodeSource source = (TagArchiveNodeSource)entry.ParentSource; string[] files = source.Library.MissingFilesArchive.GetFileList(entry.Identifier, "*", true); foreach (string file in files) { if (e.Node.Checked) { AddToQueue(file); } else { RemoveFromQueue(file); } } } else if (entry.NodeType is UnextractedFileNodeType) { if (e.Node.Checked) { AddToQueue(entry.Identifier); } else { RemoveFromQueue(entry.Identifier); } } } UpdateExtractionButton(); treeView.GetLastNode().EnsureVisible(); } finally { Cursor = Cursors.Default; } }