Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Helpers.Extensions.EndianExtensions Class Reference

Extension methods for reading big-endian versions of data More...

Static Public Member Functions

static short ReadInt16BE (this BinaryReader reader)
 Read 16-bit integer big-endian More...
 
static int ReadInt32BE (this BinaryReader reader)
 Reads 32 bit big-endian More...
 
static long ReadInt64BE (this BinaryReader reader)
 Reads 64-bit big-endian More...
 

Detailed Description

Extension methods for reading big-endian versions of data

Member Function Documentation

static short pluginbase.Helpers.Extensions.EndianExtensions.ReadInt16BE ( this BinaryReader  reader)
static

Read 16-bit integer big-endian

Returns
The int16
Parameters
readerReader.

Attribute: 1] | data[0

<< 8);

17  {
18  byte[] data = reader.ReadBytes(2);
19  return (short)(data[1] | data[0] << 8);
20  }
static int pluginbase.Helpers.Extensions.EndianExtensions.ReadInt32BE ( this BinaryReader  reader)
static

Reads 32 bit big-endian

Returns
The int32
Parameters
readerReader.

Attribute: 3] | data[2] << 8 | data[1] << 16 | data[0

<< 24;

28  {
29  byte[] data = reader.ReadBytes(4);
30  return data[3] | data[2] << 8 | data[1] << 16 | data[0] << 24;
31  }
static long pluginbase.Helpers.Extensions.EndianExtensions.ReadInt64BE ( this BinaryReader  reader)
static

Reads 64-bit big-endian

Returns
The int64
Parameters
readerReader.
39  {
40  long high = ReadInt32BE(reader);
41  long low = ReadInt32BE(reader);
42  return high << 32 | low;
43  }
static int ReadInt32BE(this BinaryReader reader)
Reads 32 bit big-endian
Definition: EndianExtensions.cs:27

The documentation for this class was generated from the following file: