Table of Contents

Class EoWriter

Namespace
Moffat.EndlessOnline.SDK.Data
Assembly
Moffat.EndlessOnline.SDK.dll

A class for writing EO data to a sequence of bytes.

public sealed class EoWriter
Inheritance
EoWriter
Inherited Members

Constructors

EoWriter()

public EoWriter()

Properties

Length

Gets a value indicating the length of the writer data

public int Length { get; }

Property Value

int

StringSanitization

Gets or sets a value toggling whether strings are sanitized for this writer.

public bool StringSanitization { get; set; }

Property Value

bool

Remarks

With string sanitization enabled, the writer will switch 0xFF bytes in strings (ΓΏ) to 0x79 (y).

See Chunked Reading: Sanitization

Methods

AddByte(int)

Adds a raw byte to the writer data.

public void AddByte(int value)

Parameters

value int

The byte to add.

Exceptions

ArgumentException

Thrown if the value is above 0xFF.

AddBytes(byte[])

Adds an array of raw bytes to the writer data.

public void AddBytes(byte[] bytes)

Parameters

bytes byte[]

The array of bytes to add.

AddChar(int)

Adds an encoded 1-byte integer to the writer data.

public void AddChar(int number)

Parameters

number int

The number to encode and add

Exceptions

ArgumentException

If the value is not below CHAR_MAX

AddEncodedString(string)

Adds an encoded string to the writer data.

public void AddEncodedString(string str)

Parameters

str string

The string to be encoded and added

AddFixedEncodedString(string, int)

Adds a fixed-length encoded string to the writer data.

public void AddFixedEncodedString(string str, int length)

Parameters

str string

The string to be encoded and added

length int

The expected length of the string

Exceptions

ArgumentException

If the string does not have the expected length

AddFixedEncodedString(string, int, bool)

Adds a fixed-length encoded string to the writer data.

public void AddFixedEncodedString(string str, int length, bool padded)

Parameters

str string

The string to be encoded added

length int

The expected length of the string

padded bool

True if the string should be padded to the length with trailing 0xFF bytes

Exceptions

ArgumentException

If the string does not have the expected length

AddFixedString(string, int)

Adds a fixed-length string to the writer data.

public void AddFixedString(string str, int length)

Parameters

str string

The string to be added

length int

The expected length of the string

Exceptions

ArgumentException

If the string does not have the expected length

AddFixedString(string, int, bool)

Adds a fixed-length string to the writer data.

public void AddFixedString(string str, int length, bool padded)

Parameters

str string

The string to be added

length int

The expected length of the string

padded bool

True if the string should be padded to the length with trailing 0xFF bytes

Exceptions

ArgumentException

If the string does not have the expected length

AddInt(int)

Adds an encoded 4-byte integer to the writer data.

public void AddInt(int number)

Parameters

number int

The number to encode and add

Exceptions

ArgumentException

If the value is not below INT_MAX

AddShort(int)

Adds an encoded 2-byte integer to the writer data.

public void AddShort(int number)

Parameters

number int

The number to encode and add

Exceptions

ArgumentException

If the value is not below SHORT_MAX

AddString(string)

Adds a string to the writer data.

public void AddString(string str)

Parameters

str string

The string to be added

AddThree(int)

Adds an encoded 3-byte integer to the writer data.

public void AddThree(int number)

Parameters

number int

The number to encode and add

Exceptions

ArgumentException

If the value is not below THREE_MAX

ToByteArray()

Gets the writer data as a byte array.

public byte[] ToByteArray()

Returns

byte[]

A copy of the writer data as a byte array