C# Класс Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pccrr.MarshalHelper

This class is used to marshal simple types.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

ByteArrayToString() публичный статический Метод

Transfer a byte array to a binary string.
public static ByteArrayToString ( byte buffer ) : string
buffer byte The input byte array
Результат string

GetBytes() публичный статический Метод

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.
Результат byte[]

GetBytes() публичный статический Метод

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
Результат byte[]

GetBytes() публичный статический Метод

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.
Результат byte[]

GetBytes() публичный статический Метод

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.
Результат byte[]

GetDateTime() публичный статический Метод

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.
Результат System.DateTime

GetUInt16() публичный статический Метод

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.
Результат ushort

GetUInt32() публичный статический Метод

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.
Результат uint

GetUInt64() публичный статический Метод

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.
Результат ulong

ReverseByFlag() публичный статический Метод

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
Результат void