mikeownage.com

Site

News
Downloads
My Directory
Battle.net Archive
My YouTube
Contact Me

Gaming

Supreme Ruler

Projects

Asgard3
Asgard Server
Binary Gateway 2
Supreme Ruler Files
Supreme Ruler Toolkit

Clan

GDN
 Class DataReader
Generated by DocFX

Class DataReader

Operates as a buffered data reader for network and file input.

Inheritance
System.Object
DataReader
BncsReader
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: MBNCSUtil
Assembly: MBNCSUtil.dll
Syntax
public class DataReader
Remarks

This class does not write data in any manner; for writing or sending data, use the DataBuffer or derived classes.

This class always uses little-endian byte ordering.

Constructors

| Improve this Doc View Source

DataReader(Byte[])

Creates a new data reader with the specified byte data.

Declaration
public DataReader(byte[] data)
Parameters
Type Name Description
System.Byte[] data

The data to read.

| Improve this Doc View Source

DataReader(Stream, Int32)

Creates a new data reader with the specified stream as input.

Declaration
public DataReader(Stream str, int length)
Parameters
Type Name Description
System.IO.Stream str

The stream from which to read.

System.Int32 length

The length of the data to read from the stream.

Remarks

This constructor will block until a full packet has been returned.

Properties

| Improve this Doc View Source

Data

Gets a copy of the data used by the current instance. When overridden in a derived class, allows this class to access an alternative data source.

Declaration
protected virtual byte[] Data { get; }
Property Value
Type Description
System.Byte[]
| Improve this Doc View Source

Length

Gets the length of the data.

Declaration
public virtual int Length { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Peek()

Reads the next byte in the stream but does not consume it.

Declaration
public int Peek()
Returns
Type Description
System.Int32

A byte value (0-255) if the call succeeded, or else -1 if reading past the end of the stream.

| Improve this Doc View Source

PeekDwordString(Byte)

Peeks at the next possible four-byte string with the specified byte padding without advancing the index.

Declaration
public string PeekDwordString(byte padding)
Parameters
Type Name Description
System.Byte padding

The byte used to pad the string to total four bytes.

Returns
Type Description
System.String

The next 4-byte string, reversed, from the stream.

| Improve this Doc View Source

ReadBoolean()

Reads a boolean value from the data stream.

Declaration
public bool ReadBoolean()
Returns
Type Description
System.Boolean

The next boolean value from the data stream.

Remarks

This method interprets a 32-bit value from the stream as false if it is zero and true if it is nonzero.

| Improve this Doc View Source

ReadByte()

Reads a byte value from the data stream.

Declaration
public byte ReadByte()
Returns
Type Description
System.Byte

The next byte from the data stream.

| Improve this Doc View Source

ReadByteArray(Int32)

Reads a byte array from the data stream.

Declaration
public byte[] ReadByteArray(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of bytes to read from the stream.

Returns
Type Description
System.Byte[]

The next expectedItems bytes from the stream.

| Improve this Doc View Source

ReadCString()

Reads the next C-style ASCII null-terminated string from the stream.

Declaration
public string ReadCString()
Returns
Type Description
System.String

The next C-style string.

| Improve this Doc View Source

ReadCString(Encoding)

Reads the next C-style null-terminated string from the stream.

Declaration
public string ReadCString(Encoding enc)
Parameters
Type Name Description
System.Text.Encoding enc

The encoding used for the string.

Returns
Type Description
System.String

The next C-style string encoded with the specified encoding.

| Improve this Doc View Source

ReadData()

Reads all remaining data from the stream.

Declaration
public byte[] ReadData()
Returns
Type Description
System.Byte[]

All remaining data in the stream.

| Improve this Doc View Source

ReadDwordString(Byte)

Reads the next possible four-byte string with the specified byte padding.

Declaration
public string ReadDwordString(byte padding)
Parameters
Type Name Description
System.Byte padding

The byte used to pad the string to total four bytes.

Returns
Type Description
System.String

The next 4-byte string, reversed, from the stream.

| Improve this Doc View Source

ReadInt16()

Reads a signed 16-bit value from the data stream.

Declaration
public short ReadInt16()
Returns
Type Description
System.Int16

The next 16-bit value from the data stream.

| Improve this Doc View Source

ReadInt16Array(Int32)

Reads an array of signed 16-bit values from the data stream.

Declaration
public short[] ReadInt16Array(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of 16-bit values to read from the stream.

Returns
Type Description
System.Int16[]

The next expectedItems 16-bit values from the stream.

| Improve this Doc View Source

ReadInt32()

Reads a signed 32-bit value from the data stream.

Declaration
public int ReadInt32()
Returns
Type Description
System.Int32

The next 32-bit value from the data stream.

| Improve this Doc View Source

ReadInt32Array(Int32)

Reads an array of signed 32-bit values from the data stream.

Declaration
public int[] ReadInt32Array(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of 32-bit values to read from the stream.

Returns
Type Description
System.Int32[]

The next expectedItems 32-bit values from the stream.

| Improve this Doc View Source

ReadInt64()

Reads a signed 64-bit value from the data stream.

Declaration
public long ReadInt64()
Returns
Type Description
System.Int64

The next 64-bit value from the data stream.

| Improve this Doc View Source

ReadInt64Array(Int32)

Reads an array of signed 64-bit values from the data stream.

Declaration
public long[] ReadInt64Array(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of 64-bit values to read from the stream.

Returns
Type Description
System.Int64[]

The next expectedItems 64-bit values from the stream.

| Improve this Doc View Source

ReadNullTerminatedByteArray()

Reads a null-terminated byte array from the data stream.

Declaration
public byte[] ReadNullTerminatedByteArray()
Returns
Type Description
System.Byte[]

The next byte array in the stream, terminated by a value of 0.

Remarks

The return value includes the null terminator.

| Improve this Doc View Source

ReadPascalString()

Reads the next pascal-style ASCII string from the stream.

Declaration
public string ReadPascalString()
Returns
Type Description
System.String

The next pascal-style string.

| Improve this Doc View Source

ReadPascalString(Encoding)

Reads the next pascal-style string from the stream.

Declaration
public string ReadPascalString(Encoding enc)
Parameters
Type Name Description
System.Text.Encoding enc

The encoding used for the string.

Returns
Type Description
System.String

The next pascal-style string encoded with the specified encoding.

| Improve this Doc View Source

ReadTerminatedString(Char, Encoding)

Returns the next variable-length string with the specified terminator character.

Declaration
public string ReadTerminatedString(char Terminator, Encoding enc)
Parameters
Type Name Description
System.Char Terminator

The terminator that should indicate the end of the string.

System.Text.Encoding enc

The encoding to use to read the string.

Returns
Type Description
System.String

A variable-length string with no NULL (0) characters nor the terminator character.

| Improve this Doc View Source

ReadUInt16()

Reads an unsigned 16-bit value from the data stream.

Declaration
[CLSCompliant(false)]
public ushort ReadUInt16()
Returns
Type Description
System.UInt16

The next 16-bit value from the data stream.

Remarks

This method is not CLS-compliant.

| Improve this Doc View Source

ReadUInt16Array(Int32)

Reads an array of unsigned 16-bit values from the data stream.

Declaration
[CLSCompliant(false)]
public ushort[] ReadUInt16Array(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of 16-bit values to read from the stream.

Returns
Type Description
System.UInt16[]

The next expectedItems 16-bit values from the stream.

Remarks

This method is not CLS-compliant.

| Improve this Doc View Source

ReadUInt32()

Reads an unsigned 32-bit value from the data stream.

Declaration
[CLSCompliant(false)]
public uint ReadUInt32()
Returns
Type Description
System.UInt32

The next 32-bit value from the data stream.

Remarks

This method is not CLS-compliant.

| Improve this Doc View Source

ReadUInt32Array(Int32)

Reads an array of signed 32-bit values from the data stream.

Declaration
[CLSCompliant(false)]
public uint[] ReadUInt32Array(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of 32-bit values to read from the stream.

Returns
Type Description
System.UInt32[]

The next expectedItems 32-bit values from the stream.

Remarks

This method is not CLS-compliant.

| Improve this Doc View Source

ReadUInt64()

Reads an unsigned 64-bit value from the data stream.

Declaration
[CLSCompliant(false)]
public ulong ReadUInt64()
Returns
Type Description
System.UInt64

The next 64-bit value from the data stream.

Remarks

This method is not CLS-compliant.

| Improve this Doc View Source

ReadUInt64Array(Int32)

Reads an array of unsigned 64-bit values from the data stream.

Declaration
[CLSCompliant(false)]
public ulong[] ReadUInt64Array(int expectedItems)
Parameters
Type Name Description
System.Int32 expectedItems

The number of 64-bit values to read from the stream.

Returns
Type Description
System.UInt64[]

The next expectedItems 64-bit values from the stream.

Remarks

This method is not CLS-compliant.

| Improve this Doc View Source

ReadWidePascalString()

Reads the next wide-pascal-style string from the stream.

Declaration
public string ReadWidePascalString()
Returns
Type Description
System.String

The next wide-pascal-style string.

| Improve this Doc View Source

ReadWidePascalString(Encoding)

Reads the next wide-pascal-style string from the stream.

Declaration
public string ReadWidePascalString(Encoding enc)
Parameters
Type Name Description
System.Text.Encoding enc

The encoding used for the string.

Returns
Type Description
System.String

The next wide-pascal-style string encoded with the specified encoding.

| Improve this Doc View Source

Seek(Int32)

Checks to see whether the offset from the current position lies within the stream and, if so, advances to that position relative to the current location.

Declaration
public bool Seek(int offset)
Parameters
Type Name Description
System.Int32 offset

The number of bytes beyond the current position to advance to.

Returns
Type Description
System.Boolean

True if the position lies within the stream and the cursor was advanced; otherwise false.

| Improve this Doc View Source

ToString()

Gets a hex representation of this buffer.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representing this buffer's contents in hexadecimal notation.

Overrides
System.Object.ToString()


Copyright © 2010 - 2025 mikeownage.com all rights reserved.