예제 #1
0
        public void Save(string mypath)
        {
            BinaryWriter binaryWriter = new BinaryWriter(File.Open(mypath, FileMode.Create));

            RoseFile.WriteBString(ref binaryWriter, this.type);
            binaryWriter.Write(this.entryCount);
            for (int i = 0; i < this.entryCount; i++)
            {
                RoseFile.WriteBString(ref binaryWriter, this.entry[i].string_ID);
                binaryWriter.Write(this.entry[i].ID);
            }
            if (this.clientType == ClientType.JROSE)
            {
                for (int i = 0; i < this.languageCount; i++)
                {
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        RoseFile.WriteBString(ref binaryWriter, this.entry[j].text[i]);
                        if (this.type == "QEST01" || this.type == "ITST01")
                        {
                            RoseFile.WriteBString(ref binaryWriter, this.entry[j].comment[i]);
                            if (this.type == "QEST01")
                            {
                                RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest1[i]);
                                RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest2[i]);
                            }
                        }
                    }
                }
            }
            else
            {
                binaryWriter.Write(this.languageCount);
                long position = binaryWriter.BaseStream.Position;
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryWriter.Write(1);
                }
                uint value = Convert.ToUInt32(binaryWriter.BaseStream.Position);
                for (int j = 0; j < this.entryCount; j++)
                {
                    binaryWriter.Write(1);
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].Offset[1] = Convert.ToUInt32(binaryWriter.BaseStream.Position);
                    RoseFile.WriteBString(ref binaryWriter, this.entry[j].text[1]);
                    if (this.type == "QEST01" || this.type == "ITST01")
                    {
                        RoseFile.WriteBString(ref binaryWriter, this.entry[j].comment[1]);
                        if (this.type == "QEST01")
                        {
                            RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest1[1]);
                            RoseFile.WriteBString(ref binaryWriter, this.entry[j].quest2[1]);
                        }
                    }
                }
                binaryWriter.BaseStream.Seek(position, SeekOrigin.Begin);
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryWriter.Write(value);
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    binaryWriter.Write(this.entry[j].Offset[1]);
                }
            }
            binaryWriter.Close();
        }