Recurity.Swf.Rect.Parse C# (CSharp) Метод

Parse() публичный Метод

TODO : Documentation
public Parse ( Stream source ) : void
source Stream
Результат void
        public void Parse( Stream source )
        {
            BitStream bits = new BitStream(source);

            if (source.Length < 1)
            {
                throw new ArgumentException("Source does not contain enough data. Length = " + source.Length.ToString("d"));
            }
            else
            {
                //
                // The first 5 bits declare how many bits per entry are used
                //
                _bits_per_entry = bits.GetBits(5);
            }
            _x_min = bits.GetBitsSigned( _bits_per_entry );
            _x_max = bits.GetBitsSigned( _bits_per_entry );
            _y_min = bits.GetBitsSigned( _bits_per_entry );
            _y_max = bits.GetBitsSigned( _bits_per_entry );
        }

Usage Example

Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public void Parse(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            _FrameSize = new Rect(this.Version);
            _FrameSize.Parse(input);

            _FrameRateDelay = br.ReadUInt16();
            _FrameRate = (_FrameRateDelay >> 8) + ((_FrameRateDelay & 0xFF) / 100);
            _FrameCount = br.ReadUInt16();

            int x = Math.Abs((this._FrameSize.Xmax - this._FrameSize.Xmin) / 12);
            int y = Math.Abs((this._FrameSize.Ymax - this._FrameSize.Ymin) / 12);

            if (x > SwfFile.Configuration.MaximumStageSizeX)
            {
                Log.Warn(this, "The x value(" + x + ") of the stage exceeds the allowed maximum.");
            }

            if (x < SwfFile.Configuration.MinimumStageSizeX)
            {
                Log.Warn(this, "The x value(" + x + ") of the stage under-runs the allowed minimum.");
            }

            if (y > SwfFile.Configuration.MaximumStageSizeY)
            {
                Log.Warn(this, "The y value(" + y + ") of the stage exceeds the allowed maximum.");
            }
            if (y < SwfFile.Configuration.MinimumStageSizeY)
            {
                Log.Warn(this, "The y value(" + y + ") of the stage under-runs the allowed minimum.");
            }
        }