Parse() public method

Parses this object out of a stream
public Parse ( Stream input ) : void
input Stream The input stream.
return void
Exemplo n.º 1
0
        // TODO: sometimes index out of bounds exception occurs here. Reheck
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="colorTableSize"></param>
        /// <param name="imageDataSize"></param>
        public virtual void Parse( Stream input, byte colorTableSize, UInt32 imageDataSize )
        {
            //Log.Debug(this, "Image data size is:" + imageDataSize + ". Color table size is: " + colorTableSize  );
            Rgb temp = null;

            for ( byte i = 0; i <= colorTableSize; i++ ) // because we need BitmapColorTableSize + 1 elements
            {
                temp = new Rgb( this._SwfVersion );
                temp.Parse( input );
                _colorTableRGB.Add( temp );
            }

            try
            {
                this._colormapPixelData = new byte[(Int32)imageDataSize];
                input.Read(this._colormapPixelData, 0, (Int32)imageDataSize);
            }
            catch (IndexOutOfRangeException e)
            {
               Log.Error(this, e.Message);
                throw e;
            }
        }