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
StringSanitization
Gets or sets a value toggling whether strings are sanitized for this writer.
public bool StringSanitization { get; set; }
Property Value
Remarks
With string sanitization enabled, the writer will switch 0xFF bytes in strings (ΓΏ) to 0x79 (y).
Methods
AddByte(int)
Adds a raw byte to the writer data.
public void AddByte(int value)
Parameters
valueintThe 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
bytesbyte[]The array of bytes to add.
AddChar(int)
Adds an encoded 1-byte integer to the writer data.
public void AddChar(int number)
Parameters
numberintThe 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
strstringThe 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
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
strstringThe string to be encoded added
lengthintThe expected length of the string
paddedboolTrue if the string should be padded to the length with trailing
0xFFbytes
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
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
strstringThe string to be added
lengthintThe expected length of the string
paddedboolTrue if the string should be padded to the length with trailing
0xFFbytes
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
numberintThe 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
numberintThe 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
strstringThe string to be added
AddThree(int)
Adds an encoded 3-byte integer to the writer data.
public void AddThree(int number)
Parameters
numberintThe 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