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

Parse() public method

public Parse ( Stream input ) : void
input Stream
return void
        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.");
            }
        }

Usage Example

コード例 #1
0
ファイル: FwsFile.cs プロジェクト: rtezli/Blitzableiter
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public override Stream Read( Stream input )
        {
            ReadHeader( input );

            //if (input.Length < Length)
            //{
            //    Exception e = new SwfFormatException("Stream length " + input.Length.ToString() + " shorter than header declared length " + Length.ToString());
            //    Log.Error(this, e);
            //    throw e;
            //}
            //else if (input.Length > Length)
            //{
            //    Log.Warn(this, "Stream length " + input.Length.ToString() + " greater than header declared length " + Length.ToString());
            //    Log.Warn(this, "Trailing garbage detected!");
            //}

            FrameHeader = new FrameHeaderInfo( this.Version );
            FrameHeader.Parse( input );

            return input;
        }