StdPaint.ConsoleBuffer.Save C# (CSharp) Method

Save() public method

Writes the buffer data to a file.
public Save ( string path ) : void
path string The path to the file.
return void
        public void Save(string path)
        {
            using(BinaryWriter writer = new BinaryWriter(File.Create(path)))
            {
                writer.Write(_width);
                writer.Write(_height);
                for(int i = 0; i < _width; i++)
                for(int j = 0; j < _height; j++)
                {
                    writer.Write((short)_buffer[j, i]._attrs);
                    writer.Write(_buffer[j, i].CharData);
                }
            }
        }