Recurity.Swf.Shape.Parse C# (CSharp) Method

Parse() public method

public Parse ( Stream input, System.Int64 length, TagTypes caller ) : void
input Stream
length System.Int64
caller TagTypes
return void
        public virtual void Parse(Stream input, Int64 length, TagTypes caller)
        {
            BitStream bits = new BitStream(input);

            this._numFillBits = (UInt16)bits.GetBits(4);
            this._numLineBits = (UInt16)bits.GetBits(4);

            if (length >= 1)
            {

                this._shapeRecordBuffer = new Byte[length - 1];
                input.Read(this._shapeRecordBuffer, 0, (Int32)length - 1);
                this._shapeRecordStream = new MemoryStream();

                this._shapeRecordStream.Write(this._shapeRecordBuffer, 0, this._shapeRecordBuffer.Length); // To protect the input stream
                this._shapeRecordStream.Seek(0, SeekOrigin.Begin);
                this.TryParseShapeRecords(this._shapeRecordStream, caller);

            }
            else
            {
                Log.Warn(this, "Attempt to parse shapes out of a too small field by: " + caller + ". Length was: " + length);
            }
        }