C# Класс ME3Explorer.EndianBitConverter

Converts base data types to an array of bytes, and an array of bytes to base data types. All info taken from the meta data of System.BitConverter. This implementation allows for Endianness consideration.
Показать файл Открыть проект

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

Метод Описание
GetBytes ( bool value ) : byte[]

Returns the specified Boolean value as an array of bytes. Parameters: value: A Boolean value. Returns: An array of bytes with length 1.

GetBytes ( char value ) : byte[]

Returns the specified Unicode character value as an array of bytes. Parameters: value: A character to convert. Returns: An array of bytes with length 2.

GetBytes ( double value ) : byte[]

Returns the specified double-precision floating point value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 8.

GetBytes ( float value ) : byte[]

Returns the specified single-precision floating point value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 4.

GetBytes ( int value ) : byte[]

Returns the specified 32-bit signed integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 4.

GetBytes ( long value ) : byte[]

Returns the specified 64-bit signed integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 8.

GetBytes ( short value ) : byte[]

Returns the specified 16-bit signed integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 2.

GetBytes ( uint value ) : byte[]

Returns the specified 32-bit unsigned integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 4.

GetBytes ( ulong value ) : byte[]

Returns the specified 64-bit unsigned integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 8.

GetBytes ( ushort value ) : byte[]

Returns the specified 16-bit unsigned integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 2.

ToBoolean ( byte value, int startIndex ) : bool

Returns a Boolean value converted from one byte at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: true if the byte at startIndex in value is nonzero; otherwise, false. Exceptions: System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToChar ( byte value, int startIndex ) : char

Returns a Unicode character converted from two bytes at a specified position in a byte array. Parameters: value: An array. startIndex: The starting position within value. Returns: A character formed by two bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex equals the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToDouble ( byte value, int startIndex ) : double

Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A double precision floating point number formed by eight bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 7, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToInt16 ( byte value, int startIndex ) : short

Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 16-bit signed integer formed by two bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex equals the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToInt32 ( byte value, int startIndex ) : int

Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit signed integer formed by four bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 3, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToInt64 ( byte value, int startIndex ) : long

Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit signed integer formed by eight bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 7, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToSingle ( byte value, int startIndex ) : float

Returns a single-precision floating point number converted from four bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A single-precision floating point number formed by four bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 3, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToString ( byte value ) : string

Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string representation. Parameters: value: An array of bytes. Returns: A System.String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A". Exceptions: System.ArgumentNullException: value is null.

ToString ( byte value, int startIndex ) : string

Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A System.String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in a subarray of value; for example, "7F-2C-4A". Exceptions: System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToString ( byte value, int startIndex, int length ) : string

Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. Parameters: value: An array of bytes. startIndex: The starting position within value. length: The number of array elements in value to convert. Returns: A System.String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in a subarray of value; for example, "7F-2C-4A". Exceptions: System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex or length is less than zero. -or- startIndex is greater than zero and is greater than or equal to the length of value. System.ArgumentException: The combination of startIndex and length does not specify a position within value; that is, the startIndex parameter is greater than the length of value minus the length parameter.

ToUInt16 ( byte value, int startIndex ) : ushort

Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. Parameters: value: The array of bytes. startIndex: The starting position within value. Returns: A 16-bit unsigned integer formed by two bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex equals the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToUInt32 ( byte value, int startIndex ) : uint

Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit unsigned integer formed by four bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 3, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

ToUInt64 ( byte value, int startIndex ) : ulong

Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit unsigned integer formed by the eight bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 7, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.

Приватные методы

Метод Описание
EndianBitConverter ( ) : System

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

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

Returns the specified Boolean value as an array of bytes. Parameters: value: A Boolean value. Returns: An array of bytes with length 1.
public static GetBytes ( bool value ) : byte[]
value bool
Результат byte[]

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

Returns the specified Unicode character value as an array of bytes. Parameters: value: A character to convert. Returns: An array of bytes with length 2.
public static GetBytes ( char value ) : byte[]
value char
Результат byte[]

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

Returns the specified double-precision floating point value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 8.
public static GetBytes ( double value ) : byte[]
value double
Результат byte[]

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

Returns the specified single-precision floating point value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 4.
public static GetBytes ( float value ) : byte[]
value float
Результат byte[]

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

Returns the specified 32-bit signed integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 4.
public static GetBytes ( int value ) : byte[]
value int
Результат byte[]

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

Returns the specified 64-bit signed integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 8.
public static GetBytes ( long value ) : byte[]
value long
Результат byte[]

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

Returns the specified 16-bit signed integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 2.
public static GetBytes ( short value ) : byte[]
value short
Результат byte[]

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

Returns the specified 32-bit unsigned integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 4.
public static GetBytes ( uint value ) : byte[]
value uint
Результат byte[]

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

Returns the specified 64-bit unsigned integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 8.
public static GetBytes ( ulong value ) : byte[]
value ulong
Результат byte[]

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

Returns the specified 16-bit unsigned integer value as an array of bytes. Parameters: value: The number to convert. Returns: An array of bytes with length 2.
public static GetBytes ( ushort value ) : byte[]
value ushort
Результат byte[]

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

Returns a Boolean value converted from one byte at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: true if the byte at startIndex in value is nonzero; otherwise, false. Exceptions: System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToBoolean ( byte value, int startIndex ) : bool
value byte
startIndex int
Результат bool

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

Returns a Unicode character converted from two bytes at a specified position in a byte array. Parameters: value: An array. startIndex: The starting position within value. Returns: A character formed by two bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex equals the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToChar ( byte value, int startIndex ) : char
value byte
startIndex int
Результат char

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

Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A double precision floating point number formed by eight bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 7, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToDouble ( byte value, int startIndex ) : double
value byte
startIndex int
Результат double

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

Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 16-bit signed integer formed by two bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex equals the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToInt16 ( byte value, int startIndex ) : short
value byte
startIndex int
Результат short

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

Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit signed integer formed by four bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 3, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToInt32 ( byte value, int startIndex ) : int
value byte
startIndex int
Результат int

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

Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit signed integer formed by eight bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 7, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToInt64 ( byte value, int startIndex ) : long
value byte
startIndex int
Результат long

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

Returns a single-precision floating point number converted from four bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A single-precision floating point number formed by four bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 3, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToSingle ( byte value, int startIndex ) : float
value byte
startIndex int
Результат float

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

Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string representation. Parameters: value: An array of bytes. Returns: A System.String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A". Exceptions: System.ArgumentNullException: value is null.
public static ToString ( byte value ) : string
value byte
Результат string

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

Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A System.String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in a subarray of value; for example, "7F-2C-4A". Exceptions: System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToString ( byte value, int startIndex ) : string
value byte
startIndex int
Результат string

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

Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string representation. Parameters: value: An array of bytes. startIndex: The starting position within value. length: The number of array elements in value to convert. Returns: A System.String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in a subarray of value; for example, "7F-2C-4A". Exceptions: System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex or length is less than zero. -or- startIndex is greater than zero and is greater than or equal to the length of value. System.ArgumentException: The combination of startIndex and length does not specify a position within value; that is, the startIndex parameter is greater than the length of value minus the length parameter.
public static ToString ( byte value, int startIndex, int length ) : string
value byte
startIndex int
length int
Результат string

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

Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. Parameters: value: The array of bytes. startIndex: The starting position within value. Returns: A 16-bit unsigned integer formed by two bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex equals the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToUInt16 ( byte value, int startIndex ) : ushort
value byte
startIndex int
Результат ushort

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

Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 32-bit unsigned integer formed by four bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 3, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToUInt32 ( byte value, int startIndex ) : uint
value byte
startIndex int
Результат uint

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

Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. Parameters: value: An array of bytes. startIndex: The starting position within value. Returns: A 64-bit unsigned integer formed by the eight bytes beginning at startIndex. Exceptions: System.ArgumentException: startIndex is greater than or equal to the length of value minus 7, and is less than or equal to the length of value minus 1. System.ArgumentNullException: value is null. System.ArgumentOutOfRangeException: startIndex is less than zero or greater than the length of value minus 1.
public static ToUInt64 ( byte value, int startIndex ) : ulong
value byte
startIndex int
Результат ulong