MAPIInspector.Parsers.RangeCommand.Parse C# (CSharp) Метод

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

Parse from a stream.
public Parse ( FastTransferStream stream ) : void
stream FastTransferStream A stream contains RangeCommand.
Результат void
        public override void Parse(FastTransferStream stream)
        {
            this.Command = stream.ReadByte();
            this.lowValue = stream.ReadBlock((int)this.Length);
            this.highValue = stream.ReadBlock((int)this.Length);
        }

Usage Example

        /// <summary>
        /// Parse from a stream.
        /// </summary>
        /// <param name="stream">A stream contains GLOBSET.</param>
        public void Parse(FastTransferStream stream)
        {
            // A unsigned interger value indicates the bytes length in common stacks.
            uint CommonStackLength = 0;

            // A uint list indicats the pushed or poped count of bytes in common stack.
            List<uint> CommonStackCollection = new List<uint>();

            byte tmp = stream.ReadByte();
            stream.Position -= 1;

            List<Command> commands = new List<Command>();
            while (tmp != 0X00)
            {
                switch (tmp)
                {
                    case 0x01:
                    case 0x02:
                    case 0x03:
                    case 0x04:
                    case 0x05:
                    case 0x06:
                        Command PushCommand = new PushCommand();
                        PushCommand.Parse(stream);
                        commands.Add(PushCommand);
                        if ((CommonStackLength += (uint)(PushCommand as PushCommand).Command) < 6)
                        {
                            CommonStackCollection.Add((PushCommand as PushCommand).Command);
                            CommonStackLength += (uint)(PushCommand as PushCommand).Command;
                        }
                        break;
                    case 0x50:
                        Command PopCommand = new PopCommand();
                        PopCommand.Parse(stream);
                        commands.Add(PopCommand);
                        CommonStackLength -= CommonStackCollection[CommonStackCollection.Count - 1];
                        break;
                    case 0x42:
                        Command BitmaskCommand = new BitmaskCommand();
                        BitmaskCommand.Parse(stream);
                        commands.Add(BitmaskCommand);
                        break;
                    case 0x52:
                        Command RangeCommand = new RangeCommand(6 - CommonStackLength);
                        RangeCommand.Parse(stream);
                        commands.Add(RangeCommand);
                        break;
                    default:
                        break;
                }
                tmp = stream.ReadByte();
                stream.Position -= 1;
            }
            Command EndCommand = new EndCommand();
            EndCommand.Parse(stream);
            commands.Add(EndCommand);
            this.Commands = commands.ToArray();
        }