Paint.CanvasRecorder.Load C# (CSharp) Method

Load() public method

Load an existing playback file - we will probably end up adding some more commands and resaving e.g. someone has pressed 'redo' so we are reloading an existing file.
public Load ( string filename ) : void
filename string
return void
        public void Load(string filename)
        {
            using (FileStream stream = File.OpenRead(filename))
            {
                int playbackCommandTotal =
                    stream.ReadByte() |
                    (stream.ReadByte()) << 8 |
                    (stream.ReadByte()) << 16 |
                    (stream.ReadByte()) << 24;

                this.currentBrushSize =
                    stream.ReadByte() |
                    (stream.ReadByte()) << 8 |
                    (stream.ReadByte()) << 16 |
                    (stream.ReadByte()) << 24;

                this.currentColor.A = (byte)stream.ReadByte();
                this.currentColor.R = (byte)stream.ReadByte();
                this.currentColor.G = (byte)stream.ReadByte();
                this.currentColor.B = (byte)stream.ReadByte();

                var totalCommandBytes= playbackCommandTotal * BytesPerCommand;

                byte[] commands = new byte[totalCommandBytes];
                stream.Read(commands, 0, totalCommandBytes);

                this.commandList = new List<byte>(commands);
            }
        }