Ejemplo n.º 1
0
        public override void Save(bool freshWithoutChanged = false)
        {
            FileStream       fs  = DataFile.Open(FileMode.Create);
            ByteStreamWriter bsw = new ByteStreamWriter(fs);

            int w = Value.GetLength(1), h = Value.GetLength(0);

            bsw.Write(BitConverter.GetBytes(w), 4);
            bsw.Write(BitConverter.GetBytes(h), 4);

            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    bsw.Write(Value[i, j].power);
                }
            }

            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    bsw.Write((byte)Value[i, j].direction);
                }
            }

            bsw.Flush();
            bsw.Close();

            fs.Flush();
            fs.Close();

            Changed = false;
        }