Esempio n. 1
0
        /// <summary>
        /// Constructs the parent NodeInfo based on the values in the supplied NodeInfo.
        /// </summary>
        public override NodeInfo GetParentNodeInfo(NodeInfo info)
        {
            TagArchiveObjectViewNodeSource source = (TagArchiveObjectViewNodeSource)ParentSource;
            string   groupName  = source.GetHLTGroupFromFilename(info.Identifier);
            NodeInfo parentInfo = new NodeInfo(ParentSource.GetNodeType <UnextractedHLTGroupNodeType>(), groupName);

            return(parentInfo);
        }
Esempio n. 2
0
        private NodeSource SetupUnextractedObjectViewSource()
        {
            DefaultState defaultState             = new DefaultState(Resources.cd16);
            TagArchiveObjectViewNodeSource source = new TagArchiveObjectViewNodeSource("ObjectViewUnextracted", currentGame, Core.Prometheus.Instance.DocumentManager, DisplayItems.AllUnextractedItems, defaultState);

            source.LoadDependencies = false;
            AddObjectViewUnextractedMenus(source);
            return(source);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns a value indicating if the specified NodeInfo contains children.
        /// </summary>
        public override bool HasChildren(NodeInfo info)
        {
            TagArchiveObjectViewNodeSource source = (TagArchiveObjectViewNodeSource)ParentSource;

            string group = info.Identifier.Trim('[', ']');

            foreach (TypeTableEntry entry in source.Game.TypeTable.GetHighLevelTypes(group))
            {
                if (source.Library.MissingFilesArchive.FileTypeExists(entry.FullName))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
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>();
            TagArchiveObjectViewNodeSource source = (TagArchiveObjectViewNodeSource)ParentSource;

            foreach (string group in source.Game.TypeTable.HighLevelTypeGroups)
            {
                foreach (TypeTableEntry entry in source.Game.TypeTable.GetHighLevelTypes(group))
                {
                    if (source.Library.MissingFilesArchive.FileTypeExists(entry.FullName))
                    {
                        children.Add(new NodeInfo(ParentSource.GetNodeType <UnextractedHLTGroupNodeType>(), "[" + group + "]"));
                        break;
                    }
                }
            }
            return(children.ToArray());
        }
Esempio n. 5
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>();
            TagArchiveObjectViewNodeSource source = (TagArchiveObjectViewNodeSource)ParentSource;

            string group = info.Identifier.Trim('[', ']');

            foreach (TypeTableEntry entry in source.Game.TypeTable.GetHighLevelTypes(group))
            {
                // Get a list of the tags that match the HLT supplied inside the brackets.
                string[] files = (source.Library.MissingFilesArchive.GetFileList("", entry.FullName, true));
                foreach (string file in files)
                {
                    NodeInfo child = new NodeInfo(ParentSource.GetNodeType <UnextractedHLTNodeType>(), file.Trim('\\'));
                    children.Add(child);
                }
            }
            return(children.ToArray());
        }
Esempio n. 6
0
        public DialogResult ShowDialog(GameDefinition game)
        {
            //TODO: Error checking.
            treeView.Reset();

            DefaultState defaultState             = new DefaultState(Resources.cd16);
            TagArchiveObjectViewNodeSource source = new TagArchiveObjectViewNodeSource("Extracted", game, Core.Prometheus.Instance.DocumentManager,
                                                                                       DisplayItems.AllExtractedItems, defaultState);

            source.LoadDependencies = true;
            NodeHierarchy main = new NodeHierarchy(game.Name + "Tag Library", Resources.folder16);

            main.NodeSources.Add(source);

            treeView.AddNodeHierarchy(main);
            treeView.Initialize();
            treeView.SelectedNode = null;

            return(base.ShowDialog());
        }
Esempio n. 7
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>();
            TagArchiveObjectViewNodeSource source = (TagArchiveObjectViewNodeSource)ParentSource;

            // Get a list of dependencies of the tag that matches the specified path.
            Pool   pool    = Core.Prometheus.Instance.Pool;
            string tagName = Path.GetExtension(info.Identifier).Trim('.');
            Type   tagType = source.Game.TypeTable.LocateEntryByName(tagName).TagType;

            TagPath poolPath = new TagPath(info.Identifier, source.Game.GameID, TagLocation.Archive);

            string[] references = new string[0];
            try
            {
                references = pool.GetTagReferences(poolPath.ToPath(), tagType);
            }
            catch
            {
                //NodeInfo errorInfo = new NodeInfo("", "error", this);
                //MultiSourceTreeNode node = CreateNode("Error deserializing tag.", errorInfo);
                //children.Add(node);
            }

            foreach (string reference in references)
            {
                if (reference == "")
                {
                    continue;
                }
                if (!source.Library.FileExists(reference))
                {
                    continue;
                }
                NodeInfo tagInfo = new NodeInfo(source.GetNodeType <TagNodeType>(), reference);
                children.Add(tagInfo);
            }
            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>();
            TagArchiveObjectViewNodeSource source = (TagArchiveObjectViewNodeSource)ParentSource;

            foreach (string group in source.Game.TypeTable.HighLevelTypeGroups)
            {
                bool itemExists = false;
                foreach (TypeTableEntry entry in source.Game.TypeTable.GetHighLevelTypes(group))
                {
                    if (source.Library.FileTypeExists(entry.FullName))
                    {
                        itemExists = true;
                    }
                }
                if (!itemExists)
                {
                    continue;
                }
                children.Add(new NodeInfo(ParentSource.GetNodeType <HLTGroupNodeType>(), "[" + group + "]"));
            }
            return(children.ToArray());
        }