C# Class Gammtek.Conduit.IO.Converters.EndianConverter

Provides the conversion functionality between two Endian types. This is either a straight-through copy if the Endian settings are the same or a conversion routine reversing the bytes.
Exibir arquivo Open project: ME3Explorer/ME3Explorer Class Usage Examples

Public Methods

Method Description
BetweenBuffers ( byte destination, int dstIndex, byte source, int srcIndex, int count ) : void

Performs either a copy or byte order reversal from the source to the destination for count bytes based on the conversion settings.

Convert ( char data ) : char

Converts data to the target Endian format.

Convert ( double data ) : double

Converts data to the target Endian format.

Convert ( float data ) : float

Converts data to the target Endian format.

Convert ( int data ) : int

Converts data to the target Endian format.

Convert ( long data ) : long

Converts data to the target Endian format.

Convert ( short data ) : short

Converts data to the target Endian format.

Convert ( uint data ) : uint

Converts data to the target Endian format.

Convert ( ulong data ) : ulong

Converts data to the target Endian format.

Convert ( ushort data ) : ushort

Converts data to the target Endian format.

Create ( bool convert ) : EndianConverter

Creates a converter based on whether the data needs to be converted or simply copied.

ToBytes ( char data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( double data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( float data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( int data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( long data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( short data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( uint data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( ulong data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToBytes ( ushort data, byte destination, int index ) : void

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.

ToChar ( byte data, int index ) : char

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToDouble ( byte data, int index ) : double

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToInt16 ( byte data, int index ) : short

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToInt32 ( byte data, int index ) : int

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToInt64 ( byte data, int index ) : long

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToSingle ( byte data, int index ) : float

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToUInt16 ( byte data, int index ) : ushort

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToUInt32 ( byte data, int index ) : uint

Returns the type from data starting at index in the correct byte order based on the conversion settings.

ToUInt64 ( byte data, int index ) : ulong

Returns the type from data starting at index in the correct byte order based on the conversion settings.

Private Methods

Method Description
CopyLinear ( byte dst, byte src, int count ) : void
CopyReverse ( byte dst, byte src, int count ) : void
EndianConverter ( ) : System
EndianConverter ( RawCopierDelegate copier ) : System
SafeCopier ( byte dst, int dstSize, byte src, int srcSize, int count ) : void

Method Details

BetweenBuffers() public method

Performs either a copy or byte order reversal from the source to the destination for count bytes based on the conversion settings.
public BetweenBuffers ( byte destination, int dstIndex, byte source, int srcIndex, int count ) : void
destination byte
dstIndex int
source byte
srcIndex int
count int
return void

Convert() public method

Converts data to the target Endian format.
public Convert ( char data ) : char
data char
return char

Convert() public method

Converts data to the target Endian format.
public Convert ( double data ) : double
data double
return double

Convert() public method

Converts data to the target Endian format.
public Convert ( float data ) : float
data float
return float

Convert() public method

Converts data to the target Endian format.
public Convert ( int data ) : int
data int
return int

Convert() public method

Converts data to the target Endian format.
public Convert ( long data ) : long
data long
return long

Convert() public method

Converts data to the target Endian format.
public Convert ( short data ) : short
data short
return short

Convert() public method

Converts data to the target Endian format.
public Convert ( uint data ) : uint
data uint
return uint

Convert() public method

Converts data to the target Endian format.
public Convert ( ulong data ) : ulong
data ulong
return ulong

Convert() public method

Converts data to the target Endian format.
public Convert ( ushort data ) : ushort
data ushort
return ushort

Create() public static method

Creates a converter based on whether the data needs to be converted or simply copied.
public static Create ( bool convert ) : EndianConverter
convert bool
return EndianConverter

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( char data, byte destination, int index ) : void
data char
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( double data, byte destination, int index ) : void
data double
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( float data, byte destination, int index ) : void
data float
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( int data, byte destination, int index ) : void
data int
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( long data, byte destination, int index ) : void
data long
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( short data, byte destination, int index ) : void
data short
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( uint data, byte destination, int index ) : void
data uint
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( ulong data, byte destination, int index ) : void
data ulong
destination byte
index int
return void

ToBytes() public method

Copies the bytes from data to destination starting at index either linearly or reversed based on the conversion settings.
public ToBytes ( ushort data, byte destination, int index ) : void
data ushort
destination byte
index int
return void

ToChar() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToChar ( byte data, int index ) : char
data byte
index int
return char

ToDouble() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToDouble ( byte data, int index ) : double
data byte
index int
return double

ToInt16() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToInt16 ( byte data, int index ) : short
data byte
index int
return short

ToInt32() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToInt32 ( byte data, int index ) : int
data byte
index int
return int

ToInt64() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToInt64 ( byte data, int index ) : long
data byte
index int
return long

ToSingle() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToSingle ( byte data, int index ) : float
data byte
index int
return float

ToUInt16() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToUInt16 ( byte data, int index ) : ushort
data byte
index int
return ushort

ToUInt32() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToUInt32 ( byte data, int index ) : uint
data byte
index int
return uint

ToUInt64() public method

Returns the type from data starting at index in the correct byte order based on the conversion settings.
public ToUInt64 ( byte data, int index ) : ulong
data byte
index int
return ulong