/// <summary> /// Parse from a stream. /// </summary> /// <param name="stream">A stream contains EndCommand.</param> public override void Parse(FastTransferStream stream) { this.Command = stream.ReadByte(); }
/// <summary> /// Parse from a stream. /// </summary> /// <param name="stream">A stream contains SizedXid.</param> public void Parse(FastTransferStream stream) { this.xidSize = stream.ReadByte(); this.xid = new XID((int)this.xidSize); this.xid.Parse(stream); }
/// <summary> /// Parse from a stream. /// </summary> /// <param name="stream">A stream contains BitmaskCommand.</param> public override void Parse(FastTransferStream stream) { this.Command = stream.ReadByte(); this.startValue = stream.ReadByte(); this.bitmask = stream.ReadByte(); }
/// <summary> /// Parse from a stream. /// </summary> /// <param name="stream">A stream contains RangeCommand.</param> public override void Parse(FastTransferStream stream) { this.Command = stream.ReadByte(); this.lowValue = stream.ReadBlock((int)this.Length); this.highValue = stream.ReadBlock((int)this.Length); }
/// <summary> /// Parse next object from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void Parse(FastTransferStream stream) { base.Parse(stream); byte[] buffer = new byte[Guid.Empty.ToByteArray().Length]; stream.Read(buffer, 0, buffer.Length); this.propertySet = new Guid(buffer); int tmp = stream.ReadByte(); if (tmp > 0) { this.flag = (byte)tmp; } }
/// <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(); }