示例#1
0
        public QuestListFile(string inFilename, byte[] rawData, byte[] subHeader, int[] ptrs, int baseAddr)
        {
            header   = subHeader;
            filename = inFilename;

            MemoryStream inStream = new MemoryStream(rawData);
            BinaryReader inReader = new BinaryReader(inStream);

            inStream.Seek(0x8, SeekOrigin.Begin);
            int headerLoc = inReader.ReadInt32();

            inStream.Seek(headerLoc, SeekOrigin.Begin);
            int listLoc   = inReader.ReadInt32();
            int listCount = inReader.ReadInt32();

            for (int i = 0; i < listCount; i++)
            {
                inStream.Seek(listLoc - baseAddr + i * 8, SeekOrigin.Begin);
                QuestListing temp = new QuestListing();
                temp.QuestNumber = inReader.ReadInt32();
                int stringLoc = inReader.ReadInt32();
                inStream.Seek(stringLoc - baseAddr, SeekOrigin.Begin);
                StringBuilder filenameBuilder = new StringBuilder();
                byte          nextChar        = inReader.ReadByte();
                while (nextChar != 0)
                {
                    filenameBuilder.Append(Convert.ToChar(nextChar));
                    nextChar = inReader.ReadByte();
                }
                temp.FileName = filenameBuilder.ToString();
                questList.Add(temp);
            }
        }
示例#2
0
        public void LoadTextFile(string[] lines)
        {
            BindingList <QuestListing> newQuestList = new BindingList <QuestListing>();

            foreach (string line in lines)
            {
                if (line != "")
                {
                    QuestListing temp      = new QuestListing();
                    string[]     splitLine = line.Split('\t');
                    temp.QuestNumber = int.Parse(splitLine[0]);
                    temp.FileName    = splitLine[1];
                    newQuestList.Add(temp);
                }
            }
            questList = newQuestList;
        }