コード例 #1
0
        private void view_map_list(MultiSourceTreeNode node, NodeInfo info)
        {
            TagArchive archive             = (TagArchive)currentGame.GlobalTagLibrary;
            TagArchiveFileTableEntry entry =
                (TagArchiveFileTableEntry)archive.MissingFilesArchive.FileTable.GetEntry(info.Identifier, EntryType.File);

            List <string> maps = new List <string>();
            BitArray      bits = new BitArray(BitConverter.GetBytes(entry.MapsBitmask));

            for (int x = 0; x < currentGame.Maps.Length; x++)
            {
                if (bits[x])
                {
                    maps.Add(currentGame.Maps[x].Filename);
                }
            }

            string        text = "The specified tag <b>" + info.Identifier + "</b> ";
            List <TagSet> sets = archive.BuildTagLocationList(new string[] { info.Identifier }, currentGame);

            if (sets.Count == 0)
            {
                text += "does not exist in any of the available maps.";
            }
            else
            {
                string mapfile     = currentGame.Maps[sets[0].MapIndex].Filename;
                string mapListText = "exists in the following maps:<br />";
                foreach (string map in maps)
                {
                    mapListText += "- " + map;
                    if (map == mapfile)
                    {
                        mapListText += " <i>*preferred source</i>";
                    }
                    mapListText += "<br />";
                }
                text += mapListText;
            }
            MessageBoxEx.Show(text, "Unextracted Tag Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #2
0
        public void BuildPTA(GameDefinition gameDef, XmlDocument tagDocument)
        {
            TagArchive archive = new TagArchive(
                gameDef.HomePath + "\\" + gameDef.GameID + ".pta.clean", Archive.ArchiveMode.Create);


            XmlNodeList tagNodes = tagDocument.SelectNodes("//tag");

            foreach (XmlNode tagNode in tagNodes)
            {
                string      filename = tagNode.Attributes["filename"].InnerText;
                XmlNodeList mapNodes = tagNode.SelectNodes("map");

                // Calculate the map location bitmask for this tag.
                ulong bitmask = 0x0000000000000000;
                foreach (XmlNode mapNode in mapNodes)
                {
                    string map = mapNode.InnerText;
                    for (int x = 0; x < gameDef.Maps.Length; x++)
                    {
                        if (gameDef.Maps[x].Filename == map)
                        {
                            bitmask = bitmask | ((ulong)1 << x);
                        }
                    }
                }

                // Create the entry in the filetable.
                TagArchiveFileTableEntry entry = (archive.FileTable.CreateEntry(
                                                      filename, EntryType.File) as TagArchiveFileTableEntry);
                entry.MapsBitmask = bitmask;
                entry.Save(new BinaryWriter(archive.BaseStream));
            }
            archive.FileTable.Save();
            archive.Close();
        }