示例#1
0
        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();
        }