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

Parse() public method

Parses this object out of a stream
public Parse ( Stream input ) : void
input Stream The input stream.
return void
        public virtual void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);
            _Red = br.ReadByte();
            _Green = br.ReadByte();
            _Blue = br.ReadByte();
            //String s = string.Format("#{0:X2}{1:X2}{2:X2}",_Red, _Green, _Blue);
            //Log.Debug(this, "[Begin Structure] RGB : color=" + s);
            //Log.Debug(this, "[End Structure] RGB" );
        }

Usage Example

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;
            }
        }