コード例 #1
0
ファイル: STB.cs プロジェクト: Jiwan/ROSE-Content-Importer
        public void Save(string mypath)
        {
            BinaryWriter binaryWriter = new BinaryWriter(File.Open(mypath, FileMode.Create));

            RoseFile.WriteFString(ref binaryWriter, this.formatCode, 4);
            binaryWriter.Write(0);
            binaryWriter.Write(this.rowCount);
            binaryWriter.Write(this.columnCount);
            binaryWriter.Write(this.RowHeight);
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                binaryWriter.Write(this.column[i].width);
            }
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                RoseFile.WriteSString(ref binaryWriter, this.column[i].title);
            }
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                RoseFile.WriteSString(ref binaryWriter, this.cell[i, 0]);
            }
            long position = binaryWriter.BaseStream.Position;

            binaryWriter.BaseStream.Seek(4L, SeekOrigin.Begin);
            binaryWriter.Write((int)position);
            binaryWriter.Seek((int)position, SeekOrigin.Begin);
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                for (int j = 0; j < this.columnCount - 1; j++)
                {
                    RoseFile.WriteSString(ref binaryWriter, this.cell[i, j + 1]);
                }
            }
            binaryWriter.Close();
        }
コード例 #2
0
        public void Save(string filePath)
        {
            this.Path = filePath;
            BinaryWriter bw = new BinaryWriter(File.Open(filePath, FileMode.Create));

            bw.Write((short)this.listDDS.Count);
            int totalElementCount = 0;

            this.listDDS.ForEach(delegate(TSI.DDS dds)
            {
                RoseFile.WriteSString(ref bw, dds.Path);
                bw.Write(dds.ColourKey);
                totalElementCount += dds.ListDDS_element.Count;
            });
            bw.Write((short)totalElementCount);
            this.listDDS.ForEach(delegate(TSI.DDS dds)
            {
                bw.Write((short)dds.ListDDS_element.Count);
                dds.ListDDS_element.ForEach(delegate(TSI.DDS.DDSElement dds_element)
                {
                    bw.Write(dds_element.OwnerId);
                    bw.Write(dds_element.X);
                    bw.Write(dds_element.Y);
                    bw.Write(dds_element.Width + dds_element.X);
                    bw.Write(dds_element.Height + dds_element.Y);
                    bw.Write(dds_element.Color);
                    RoseFile.WriteFString(ref bw, dds_element.Name, 32);
                });
            });
            bw.Close();
        }
コード例 #3
0
        public void Load(string filePath)
        {
            this.Path = filePath;
            BinaryReader binaryReader = new BinaryReader(File.Open(filePath, FileMode.Open));
            short        num          = binaryReader.ReadInt16();

            this.listDDS = new List <TSI.DDS>((int)num);
            for (int i = 0; i < (int)num; i++)
            {
                TSI.DDS dDS = new TSI.DDS();
                dDS.Path      = RoseFile.ReadSString(ref binaryReader);
                dDS.ColourKey = binaryReader.ReadInt32();
                this.listDDS.Add(dDS);
            }
            short num2 = binaryReader.ReadInt16();

            for (int i = 0; i < (int)num; i++)
            {
                short num3 = binaryReader.ReadInt16();
                this.listDDS[i].ListDDS_element = new List <TSI.DDS.DDSElement>((int)num3);
                for (int j = 0; j < (int)num3; j++)
                {
                    TSI.DDS.DDSElement dDSElement = new TSI.DDS.DDSElement();
                    dDSElement.OwnerId = binaryReader.ReadInt16();
                    dDSElement.X       = binaryReader.ReadInt32();
                    dDSElement.Y       = binaryReader.ReadInt32();
                    dDSElement.Width   = binaryReader.ReadInt32() - dDSElement.X;
                    dDSElement.Height  = binaryReader.ReadInt32() - dDSElement.Y;
                    dDSElement.Color   = binaryReader.ReadInt32();
                    dDSElement.Name    = RoseFile.ReadFString(ref binaryReader, 32);
                    this.listDDS[i].ListDDS_element.Add(dDSElement);
                }
            }
            binaryReader.Close();
        }
コード例 #4
0
 public void save(ref BinaryWriter bw)
 {
     RoseFile.WriteZString(ref bw, this.path);
     bw.Write(this.is_skin);
     bw.Write(this.alpha_enabled);
     bw.Write(this.two_sided);
     bw.Write(this.alpha_test_enabled);
     bw.Write(this.alpha_ref_enabled);
     bw.Write(this.z_write_enabled);
     bw.Write(this.z_test_enabled);
     bw.Write(this.blending_mode);
     bw.Write(this.specular_enabled);
     bw.Write(this.alpha);
     bw.Write(this.glow_type);
     bw.Write(this.red);
     bw.Write(this.green);
     bw.Write(this.blue);
 }
コード例 #5
0
 public void read(ref BinaryReader br)
 {
     this.path               = RoseFile.ReadZString(ref br);
     this.is_skin            = br.ReadInt16();
     this.alpha_enabled      = br.ReadInt16();
     this.two_sided          = br.ReadInt16();
     this.alpha_test_enabled = br.ReadInt16();
     this.alpha_ref_enabled  = br.ReadInt16();
     this.z_write_enabled    = br.ReadInt16();
     this.z_test_enabled     = br.ReadInt16();
     this.blending_mode      = br.ReadInt16();
     this.specular_enabled   = br.ReadInt16();
     this.alpha              = br.ReadSingle();
     this.glow_type          = br.ReadInt16();
     this.red   = br.ReadSingle();
     this.green = br.ReadSingle();
     this.blue  = br.ReadSingle();
 }
コード例 #6
0
ファイル: STB.cs プロジェクト: Jiwan/ROSE-Content-Importer
        public void Load(string mypath, ClientType myclientType)
        {
            this.path       = mypath;
            this.clientType = myclientType;
            BinaryReader binaryReader = new BinaryReader(File.Open(mypath, FileMode.Open));

            this.formatCode = new string(binaryReader.ReadChars(4));
            int num = binaryReader.ReadInt32();

            this.rowCount    = binaryReader.ReadInt32();
            this.columnCount = binaryReader.ReadInt32();
            this.column      = new STB.Column[this.columnCount + 1];
            this.cell        = new string[this.rowCount, this.columnCount];
            this.RowHeight   = binaryReader.ReadInt32();
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                this.column[i].width = binaryReader.ReadInt16();
            }
            for (int i = 0; i < this.columnCount + 1; i++)
            {
                this.column[i].title = RoseFile.ReadSString(ref binaryReader);
            }
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                this.cell[i, 0] = RoseFile.ReadSString(ref binaryReader);
            }
            binaryReader.BaseStream.Seek((long)num, SeekOrigin.Begin);
            for (int i = 0; i < this.rowCount - 1; i++)
            {
                for (int j = 0; j < this.columnCount - 1; j++)
                {
                    this.cell[i, j + 1] = RoseFile.ReadSString(ref binaryReader);
                }
            }
            binaryReader.Close();
        }
コード例 #7
0
 public void save(ref BinaryWriter bw)
 {
     RoseFile.WriteZString(ref bw, this.path);
 }
コード例 #8
0
 public void read(ref BinaryReader br)
 {
     this.path = RoseFile.ReadZString(ref br);
 }
コード例 #9
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();
        }
コード例 #10
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();
        }