C# Class Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pccrr.MarshalHelper

This class is used to marshal simple types.
Datei anzeigen Open project: Microsoft/WindowsProtocolTestSuites Class Usage Examples

Public Methods

Method Description
ByteArrayToString ( byte buffer ) : string

Transfer a byte array to a binary string.

GetBytes ( System.DateTime value, bool isBigEndian ) : byte[]

convert DateTime to bytes, the encoding is the seconds from 19700101

GetBytes ( byte buffer, int &index, int count ) : byte[]

get bytes from bytes

GetBytes ( uint value, bool isBigEndian ) : byte[]

convert value to bytes

GetBytes ( ushort value, bool isBigEndian ) : byte[]

convert value to bytes

GetDateTime ( byte buffer, int &index, bool isBigEndian ) : System.DateTime

Get UInt32 data from buffer, and transfer it to DateTime

GetUInt16 ( byte buffer, int &index, bool isBigEndian ) : ushort

parse UInt16 from bytes

GetUInt32 ( byte buffer, int &index, bool isBigEndian ) : uint

parse UInt32 from bytes

GetUInt64 ( byte buffer, int &index, bool isBigEndian ) : ulong

parse UInt64 from bytes

ReverseByFlag ( bool isBigEndian, byte ret ) : void

reverse the bytes if it's not big endian.

Method Details

ByteArrayToString() public static method

Transfer a byte array to a binary string.
public static ByteArrayToString ( byte buffer ) : string
buffer byte The input byte array
return string

GetBytes() public static method

convert DateTime to bytes, the encoding is the seconds from 19700101
public static GetBytes ( System.DateTime value, bool isBigEndian ) : byte[]
value System.DateTime a DateTime value
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return byte[]

GetBytes() public static method

get bytes from bytes
public static GetBytes ( byte buffer, int &index, int count ) : byte[]
buffer byte the buffer stores the value.
index int the index of start to parse
count int count of bytes
return byte[]

GetBytes() public static method

convert value to bytes
public static GetBytes ( uint value, bool isBigEndian ) : byte[]
value uint a UInt32 value
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return byte[]

GetBytes() public static method

convert value to bytes
public static GetBytes ( ushort value, bool isBigEndian ) : byte[]
value ushort a UInt16 value
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return byte[]

GetDateTime() public static method

Get UInt32 data from buffer, and transfer it to DateTime
public static GetDateTime ( byte buffer, int &index, bool isBigEndian ) : System.DateTime
buffer byte the buffer stores the value.
index int the index of start to parse
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return System.DateTime

GetUInt16() public static method

parse UInt16 from bytes
public static GetUInt16 ( byte buffer, int &index, bool isBigEndian ) : ushort
buffer byte the buffer stores the value.
index int the index of start to parse
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return ushort

GetUInt32() public static method

parse UInt32 from bytes
public static GetUInt32 ( byte buffer, int &index, bool isBigEndian ) : uint
buffer byte the buffer stores the value.
index int the index of start to parse
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return uint

GetUInt64() public static method

parse UInt64 from bytes
public static GetUInt64 ( byte buffer, int &index, bool isBigEndian ) : ulong
buffer byte the buffer stores the value.
index int the index of start to parse
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
return ulong

ReverseByFlag() public static method

reverse the bytes if it's not big endian.
public static ReverseByFlag ( bool isBigEndian, byte ret ) : void
isBigEndian bool order of bytes. If it's big endian, set it to true, else set it to false.
ret byte the bytes will be re-order
return void