C# Класс Server.Network.PacketWriter

Provides functionality for writing primitive binary data.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
CreateInstance ( ) : PacketWriter
CreateInstance ( int capacity ) : PacketWriter
Fill ( ) : void

Fills the stream from the current position up to (capacity) with 0x00's

Fill ( int length ) : void

Writes a number of 0x00 byte values to the underlying stream.

PacketWriter ( ) : System

Instantiates a new PacketWriter instance with the default capacity of 4 bytes.

PacketWriter ( int capacity ) : System

Instantiates a new PacketWriter instance with a given capacity.

ReleaseInstance ( PacketWriter pw ) : void
Seek ( long offset, SeekOrigin origin ) : long

Offsets the current position from an origin.

ToArray ( ) : byte[]

Gets the entire stream content as a byte array.

Write ( bool value ) : void

Writes a 1-byte boolean value to the underlying stream. False is represented by 0, true by 1.

Write ( byte value ) : void

Writes a 1-byte unsigned integer value to the underlying stream.

Write ( byte buffer, int offset, int size ) : void

Writes a sequence of bytes to the underlying stream

Write ( int value ) : void

Writes a 4-byte signed integer value to the underlying stream.

Write ( sbyte value ) : void

Writes a 1-byte signed integer value to the underlying stream.

Write ( short value ) : void

Writes a 2-byte signed integer value to the underlying stream.

Write ( uint value ) : void

Writes a 4-byte unsigned integer value to the underlying stream.

Write ( ushort value ) : void

Writes a 2-byte unsigned integer value to the underlying stream.

WriteAsciiFixed ( string value, int size ) : void

Writes a fixed-length ASCII-encoded string value to the underlying stream. To fit (size), the string content is either truncated or padded with null characters.

WriteAsciiNull ( string value ) : void

Writes a dynamic-length ASCII-encoded string value to the underlying stream, followed by a 1-byte null character.

WriteBigUniFixed ( string value, int size ) : void

Writes a fixed-length big-endian unicode string value to the underlying stream. To fit (size), the string content is either truncated or padded with null characters.

WriteBigUniNull ( string value ) : void

Writes a dynamic-length big-endian unicode string value to the underlying stream, followed by a 2-byte null character.

WriteLittleUniFixed ( string value, int size ) : void

Writes a fixed-length little-endian unicode string value to the underlying stream. To fit (size), the string content is either truncated or padded with null characters.

WriteLittleUniNull ( string value ) : void

Writes a dynamic-length little-endian unicode string value to the underlying stream, followed by a 2-byte null character.

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

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

public static CreateInstance ( ) : PacketWriter
Результат PacketWriter

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

public static CreateInstance ( int capacity ) : PacketWriter
capacity int
Результат PacketWriter

Fill() публичный Метод

Fills the stream from the current position up to (capacity) with 0x00's
public Fill ( ) : void
Результат void

Fill() публичный Метод

Writes a number of 0x00 byte values to the underlying stream.
public Fill ( int length ) : void
length int
Результат void

PacketWriter() публичный Метод

Instantiates a new PacketWriter instance with the default capacity of 4 bytes.
public PacketWriter ( ) : System
Результат System

PacketWriter() публичный Метод

Instantiates a new PacketWriter instance with a given capacity.
public PacketWriter ( int capacity ) : System
capacity int Initial capacity for the internal stream.
Результат System

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

public static ReleaseInstance ( PacketWriter pw ) : void
pw PacketWriter
Результат void

Seek() публичный Метод

Offsets the current position from an origin.
public Seek ( long offset, SeekOrigin origin ) : long
offset long
origin SeekOrigin
Результат long

ToArray() публичный Метод

Gets the entire stream content as a byte array.
public ToArray ( ) : byte[]
Результат byte[]

Write() публичный Метод

Writes a 1-byte boolean value to the underlying stream. False is represented by 0, true by 1.
public Write ( bool value ) : void
value bool
Результат void

Write() публичный Метод

Writes a 1-byte unsigned integer value to the underlying stream.
public Write ( byte value ) : void
value byte
Результат void

Write() публичный Метод

Writes a sequence of bytes to the underlying stream
public Write ( byte buffer, int offset, int size ) : void
buffer byte
offset int
size int
Результат void

Write() публичный Метод

Writes a 4-byte signed integer value to the underlying stream.
public Write ( int value ) : void
value int
Результат void

Write() публичный Метод

Writes a 1-byte signed integer value to the underlying stream.
public Write ( sbyte value ) : void
value sbyte
Результат void

Write() публичный Метод

Writes a 2-byte signed integer value to the underlying stream.
public Write ( short value ) : void
value short
Результат void

Write() публичный Метод

Writes a 4-byte unsigned integer value to the underlying stream.
public Write ( uint value ) : void
value uint
Результат void

Write() публичный Метод

Writes a 2-byte unsigned integer value to the underlying stream.
public Write ( ushort value ) : void
value ushort
Результат void

WriteAsciiFixed() публичный Метод

Writes a fixed-length ASCII-encoded string value to the underlying stream. To fit (size), the string content is either truncated or padded with null characters.
public WriteAsciiFixed ( string value, int size ) : void
value string
size int
Результат void

WriteAsciiNull() публичный Метод

Writes a dynamic-length ASCII-encoded string value to the underlying stream, followed by a 1-byte null character.
public WriteAsciiNull ( string value ) : void
value string
Результат void

WriteBigUniFixed() публичный Метод

Writes a fixed-length big-endian unicode string value to the underlying stream. To fit (size), the string content is either truncated or padded with null characters.
public WriteBigUniFixed ( string value, int size ) : void
value string
size int
Результат void

WriteBigUniNull() публичный Метод

Writes a dynamic-length big-endian unicode string value to the underlying stream, followed by a 2-byte null character.
public WriteBigUniNull ( string value ) : void
value string
Результат void

WriteLittleUniFixed() публичный Метод

Writes a fixed-length little-endian unicode string value to the underlying stream. To fit (size), the string content is either truncated or padded with null characters.
public WriteLittleUniFixed ( string value, int size ) : void
value string
size int
Результат void

WriteLittleUniNull() публичный Метод

Writes a dynamic-length little-endian unicode string value to the underlying stream, followed by a 2-byte null character.
public WriteLittleUniNull ( string value ) : void
value string
Результат void