private static void InitializeInfinityFiles()
        {
            chitinIndex = new ChitinIndex(appPaths.ChitinKeyFile);
            talkIndex   = new TalkIndex(appPaths.TalkRefFile);

            explorers = new IXExplorerDictionary(chitinIndex.CkeyDictionary);
        }
Ejemplo n.º 2
0
        public static bool ReadTalkRefFile(TalkIndex talkIndex, string fileName)
        {
            FileStream fileStream = Utils.ReadFileStream(fileName);

            if (fileStream == null)
            {
                return(false);
            }

            buff = new byte[FileStruct.TSTalkHeaderSize];
            fileStream.Position = 0;

            FileStruct.TSTalkHeader talkHead =
                (FileStruct.TSTalkHeader)ReadBuffer <FileStruct.TSTalkHeader>
                    (fileStream, buff, FileStruct.TSTalkHeaderSize);

            if (GlobalDefs.DIALOGTLK_SIGNATURE != Utils.CharsToString(talkHead.signature))
            {
                throw new ArgumentException("Warning: Invalid signature in *.tlk file.");
            }

            // Load up all the talkRef into a collection
            buff = new byte[FileStruct.TSTalkRefSize];
            talkIndex.TrefCollection.SetCapacity(talkHead.tlkCount);

            for (int c = 0; c < talkHead.tlkCount; c++)
            {
                FileStruct.TSTalkRef tsTalkRef =
                    (FileStruct.TSTalkRef)ReadBuffer <FileStruct.TSTalkRef>
                        (fileStream, buff, FileStruct.TSTalkRefSize);

                string strText = ReadOffsetStringBuffer(fileStream, talkHead.tlkOffset + tsTalkRef.strOffset, tsTalkRef.strSize);
                talkIndex.AddTalkRef(ref tsTalkRef, ref strText);
            }

            fileStream.Close();

            return(true);
        }