本文整理汇总了C#中Microsoft.Protocols.TestTools.StackSdk.PduMarshaler.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# PduMarshaler.ReadByte方法的具体用法?C# PduMarshaler.ReadByte怎么用?C# PduMarshaler.ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Protocols.TestTools.StackSdk.PduMarshaler
的用法示例。
在下文中一共展示了PduMarshaler.ReadByte方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadDescriptorType
/// <summary>
/// Unmarshal and validate the descriptor type from the marshaler buffer.
/// </summary>
/// <param name="marshaler">The marshaler containing raw data.</param>
/// <returns>true indicates that the field is decoded successfully and valid.</returns>
protected bool ReadDescriptorType(PduMarshaler marshaler)
{
bDescriptorType = UsbDescriptorTypes.UNKNOWN;
byte b = marshaler.ReadByte();
// TODO: don't hard-code.
if (b > 8 || b < 1)
{
return false;
}
bDescriptorType = (UsbDescriptorTypes)b;
return true;
}
示例2: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to decode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
try
{
length = marshaler.ReadUInt16();
interfaceNumber = marshaler.ReadByte();
alternateSetting = marshaler.ReadByte();
class_field = marshaler.ReadByte();
subClass = marshaler.ReadByte();
protocol = marshaler.ReadByte();
padding = marshaler.ReadByte();
interfaceHandle = marshaler.ReadUInt32();
numberOfPipes = marshaler.ReadUInt32();
if (numberOfPipes > 0)
{
pipes = new TS_USBD_PIPE_INFORMATION_RESULT[numberOfPipes];
for (int i = 0; i < pipes.Length; i++)
{
pipes[i] = new TS_USBD_PIPE_INFORMATION_RESULT();
pipes[i].Decode(marshaler);
}
}
else
{
pipes = null;
}
}
catch (Exception)
{
return false;
}
return true;
}
示例3: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to decode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
try
{
this.Header.cbSize = marshaler.ReadUInt32();
this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32();
this.PresentatioinId = marshaler.ReadByte();
this.ResponseFlags = marshaler.ReadByte();
this.ResultFlags = marshaler.ReadUInt16();
return true;
}
catch
{
marshaler.Reset();
throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
}
}
示例4: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to decode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
try
{
if (!base.Decode(marshaler)) return false;
this.tileSize = marshaler.ReadByte();
this.numRects = marshaler.ReadUInt16();
this.numQuant = marshaler.ReadByte();
this.numProgQuant = marshaler.ReadByte();
this.flags = marshaler.ReadByte();
this.decodedLen += 6;
this.numTiles = marshaler.ReadUInt16();
this.tileDataSize = marshaler.ReadUInt32();
this.decodedLen += 6;
this.rects = new TS_RFX_RECT[this.numRects];
for (int i = 0; i < this.numRects; i++)
{
this.rects[i].x = marshaler.ReadUInt16();
this.rects[i].y = marshaler.ReadUInt16();
this.rects[i].width = marshaler.ReadUInt16();
this.rects[i].height = marshaler.ReadUInt16();
this.decodedLen += (uint)Marshal.SizeOf(this.rects[i]);
}
this.quantVals = new TS_RFX_CODEC_QUANT[this.numQuant];
for (int i = 0; i < this.numQuant; i++)
{
this.quantVals[i].LL3_LH3 = marshaler.ReadByte();
this.quantVals[i].HL3_HH3 = marshaler.ReadByte();
this.quantVals[i].LH2_HL2 = marshaler.ReadByte();
this.quantVals[i].HH2_LH1 = marshaler.ReadByte();
this.quantVals[i].HL1_HH1 = marshaler.ReadByte();
this.decodedLen += 5;
}
this.quantProgVals = new RFX_PROGRESSIVE_CODEC_QUANT[this.numProgQuant];
for (int i = 0; i < this.numProgQuant; i++)
{
int quantProgSize = Marshal.SizeOf(this.quantProgVals[i]);
byte[] rawData = marshaler.ReadBytes(quantProgSize);
GCHandle handle = GCHandle.Alloc(rawData, GCHandleType.Pinned);
try
{
IntPtr rawDataPtr = handle.AddrOfPinnedObject();
this.quantProgVals[i] = (RFX_PROGRESSIVE_CODEC_QUANT)Marshal.PtrToStructure(rawDataPtr, typeof(RFX_PROGRESSIVE_CODEC_QUANT));
}
finally
{
handle.Free();
}
this.decodedLen += (uint)quantProgSize;
}
return true;
}
catch
{
marshaler.Reset();
throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
}
}
示例5: Decode
public bool Decode(PduMarshaler marshaler)
{
try
{
byte t = marshaler.ReadByte();
c = (FOUR_BYTE_C_Values)(t >> 6);
val1 = (byte)(t & 0x3F);
if (c >= FOUR_BYTE_C_Values.TWO_BYTE_VAL)
{
val2 = marshaler.ReadByte();
}
if (c >= FOUR_BYTE_C_Values.THREE_BYTE_VAL)
{
val3 = marshaler.ReadByte();
}
if (c == FOUR_BYTE_C_Values.FOUR_BYTE_VAL)
{
val4 = marshaler.ReadByte();
}
return true;
}
catch
{
return false;
}
}
示例6: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to decode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
try
{
this.descriptor = (DescriptorTypes)marshaler.ReadByte();
if (this.descriptor == DescriptorTypes.SINGLE)
{
this.bulkData = new RDP8_BULK_ENCODED_DATA();
this.bulkData.header = marshaler.ReadByte();
this.bulkData.data = marshaler.ReadToEnd();
}
else
{
this.segmentCount = marshaler.ReadUInt16();
this.uncompressedSize = marshaler.ReadUInt32();
if (this.segmentCount > 0)
{
this.segmentArray = new RDP_DATA_SEGMENT[this.segmentCount];
for (int i = 0; i < this.segmentCount; i++)
{
this.segmentArray[i].size = marshaler.ReadUInt32();
if (this.segmentArray[i].size > 0)
{
this.segmentArray[i].bulkData = new RDP8_BULK_ENCODED_DATA();
this.segmentArray[i].bulkData.header = marshaler.ReadByte();
this.segmentArray[i].bulkData.data = marshaler.ReadBytes((int)this.segmentArray[i].size - 1);
}
}
}
}
return true;
}
catch
{
marshaler.Reset();
throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
}
}
示例7: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to decode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
base.Decode(marshaler);
bInterfaceNumber = marshaler.ReadByte();
bAlternateSetting = marshaler.ReadByte();
bNumEndpoints = marshaler.ReadByte();
bInterfaceClass = marshaler.ReadByte();
bInterfaceSubClass = marshaler.ReadByte();
bInterfaceProtocol = marshaler.ReadByte();
iInterface = marshaler.ReadByte();
return true;
}
示例8: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to decode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
try
{
this.cbGeometryData = marshaler.ReadUInt32();
this.Version = (RdpegtVersionValues)marshaler.ReadUInt32();
this.MappingId = marshaler.ReadUInt64();
this.UpdateType = (UpdateTypeValues)marshaler.ReadUInt32();
this.Flags = marshaler.ReadUInt32();
this.TopLevelId = marshaler.ReadUInt64();
this.Left = marshaler.ReadUInt32();
this.Top = marshaler.ReadUInt32();
this.Right = marshaler.ReadUInt32();
this.Bottom = marshaler.ReadUInt32();
this.TopLevelLeft = marshaler.ReadUInt32();
this.TopLevelTop = marshaler.ReadUInt32();
this.TopLevelRight = marshaler.ReadUInt32();
this.TopLevelBottom = marshaler.ReadUInt32();
this.GeometryType = (GeometryTypeValues)marshaler.ReadUInt32();
this.cbGeometryBuffer = marshaler.ReadUInt32();
//Decode RGNDATA
this.pGeometryBuffer.rdh.dwSize = marshaler.ReadUInt32();
this.pGeometryBuffer.rdh.iType = marshaler.ReadUInt32();
this.pGeometryBuffer.rdh.nCount = marshaler.ReadUInt32();
this.pGeometryBuffer.rdh.nRgnSize = marshaler.ReadUInt32();
DecodeRect(marshaler, out this.pGeometryBuffer.rdh.rcBound);
this.pGeometryBuffer.Buffer = new RECT[this.pGeometryBuffer.rdh.nCount];
for (int i = 0; i < this.pGeometryBuffer.Buffer.Length; i++)
{
DecodeRect(marshaler, out this.pGeometryBuffer.Buffer[i]);
}
this.Reserved2 = marshaler.ReadByte();
return true;
}
catch
{
marshaler.Reset();
throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
}
}
示例9: Decode
/// <summary>
/// Decode this PDU from the PduMarshaler.
/// </summary>
/// <param name="marshaler">This is used to encode the fields of this PDU.</param>
public override bool Decode(PduMarshaler marshaler)
{
try
{
base.Decode(marshaler);
this.surfaceId = marshaler.ReadUInt16();
pduLen += 2;
this.fillPixel.R = marshaler.ReadByte();
this.fillPixel.G = marshaler.ReadByte();
this.fillPixel.B = marshaler.ReadByte();
this.fillPixel.XA = marshaler.ReadByte();
pduLen += 4;
this.fillRectCount = marshaler.ReadUInt16();
pduLen += 2;
for (int i = 0; i < this.fillRectCount; i++)
{
RDPGFX_RECT16 rect;
rect.left = marshaler.ReadUInt16();
rect.top = marshaler.ReadUInt16();
rect.right = marshaler.ReadUInt16();
rect.bottom = marshaler.ReadUInt16();
fillRectList.Add(rect);
pduLen += (uint)Marshal.SizeOf(rect);
}
return true;
}
catch
{
marshaler.Reset();
throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd());
}
}