Esempio n. 1
0
        public void Load(string mypath, ClientType myclientType)
        {
            this.path       = mypath;
            this.clientType = myclientType;
            BinaryReader binaryReader = new BinaryReader(new FileStream(this.path, FileMode.Open));

            this.type       = RoseFile.ReadBString(ref binaryReader);
            this.entryCount = binaryReader.ReadInt32();
            this.entry      = new STL.STLEntry[this.entryCount];
            for (int i = 0; i < this.entryCount; i++)
            {
                this.entry[i].string_ID = RoseFile.ReadBString(ref binaryReader);
                this.entry[i].ID        = binaryReader.ReadUInt32();
            }
            if (this.clientType == ClientType.JROSE)
            {
                this.languageCount = 1;
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].text    = new string[1];
                    this.entry[j].comment = new string[1];
                    this.entry[j].quest1  = new string[1];
                    this.entry[j].quest2  = new string[1];
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].text[0] = RoseFile.ReadBString(ref binaryReader);
                    if (this.type == "QEST01" || this.type == "ITST01")
                    {
                        this.entry[j].comment[0] = RoseFile.ReadBString(ref binaryReader);
                        if (this.type == "QEST01")
                        {
                            this.entry[j].quest1[0] = RoseFile.ReadBString(ref binaryReader);
                            this.entry[j].quest2[0] = RoseFile.ReadBString(ref binaryReader);
                        }
                    }
                }
            }
            else
            {
                this.languageCount  = binaryReader.ReadInt32();
                this.languageOffset = new uint[this.languageCount];
                for (int i = 0; i < this.languageCount; i++)
                {
                    this.languageOffset[i] = binaryReader.ReadUInt32();
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].Offset  = new uint[this.languageCount];
                    this.entry[j].text    = new string[this.languageCount];
                    this.entry[j].comment = new string[this.languageCount];
                    this.entry[j].quest1  = new string[this.languageCount];
                    this.entry[j].quest2  = new string[this.languageCount];
                }
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryReader.BaseStream.Seek((long)((ulong)this.languageOffset[i]), SeekOrigin.Begin);
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        this.entry[j].Offset[i] = binaryReader.ReadUInt32();
                    }
                }
                for (int i = 0; i < this.languageCount; i++)
                {
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        binaryReader.BaseStream.Seek((long)((ulong)this.entry[j].Offset[i]), SeekOrigin.Begin);
                        this.entry[j].text[i] = RoseFile.ReadBString(ref binaryReader);
                        if (this.type == "QEST01" || this.type == "ITST01")
                        {
                            this.entry[j].comment[i] = RoseFile.ReadBString(ref binaryReader);
                            if (this.type == "QEST01")
                            {
                                this.entry[j].quest1[i] = RoseFile.ReadBString(ref binaryReader);
                                this.entry[j].quest2[i] = RoseFile.ReadBString(ref binaryReader);
                            }
                        }
                    }
                }
            }
            binaryReader.Close();
        }