C# Класс GonzoNet.PacketStream

A readable and writable packet.
Наследование: Stream
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
m_VariableLength bool

Защищенные свойства (Protected)

Свойство Тип Описание
m_BaseStream System.IO.MemoryStream
m_Length int
m_Reader System.IO.BinaryReader

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

Метод Описание
Flush ( ) : void

Flushes the underlying stream.

PacketStream ( byte ID, int Length ) : System

Constructs a new PacketStream instance to write to.

PacketStream ( byte ID, int Length, byte DataBuffer ) : System

Constructs a new PacketStream instance to read from.

PeekByte ( ) : byte

Peeks a byte from the stream at the current position.

PeekByte ( int Position ) : byte

Peeks a byte from the stream at the specified position.

PeekInt ( int Position ) : int

Peeks an int from the stream at the specified position.

PeekUShort ( int Position ) : ushort

Peeks a ushort from the stream at the specified position.

Read ( byte buffer, int offset, int count ) : int

Reads a specific number of bytes from this PacketStream.

ReadByte ( ) : int

Reads a byte from this PacketStream instance.

ReadBytes ( int NumBytes ) : byte[]

Reads a specific number of bytes from this PacketStream.

ReadDouble ( ) : double

Reads a double from this PacketStream instance.

ReadInt32 ( ) : int

Reads an integer from this PacketStream instance.

ReadInt64 ( ) : long

Reads a long integer from this PacketStream instance.

ReadString ( ) : string

Reads a string from this PacketStream instance.

ReadString ( int NumChars ) : string

Reads a string from this PacketStream instance.

ReadUInt16 ( ) : ushort

Reads a short from this PacketStream instance.

ReadUInt64 ( ) : ulong

Reads an unsigned long integer from this PacketStream instance.

ReadUShort ( ) : ushort

Reads a ushort from this PacketStream instance.

Seek ( long offset, SeekOrigin origin ) : long

Do not call this! It will throw a NotImplementedException!

SetLength ( long value ) : void

Sets the length of this PacketStream to the specified value.

ToArray ( ) : byte[]

Creates an array of bytes with the data in this PacketStream instance.

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

Writes a block of bytes to this PacketStream instance.

WriteByte ( byte Value ) : void

Writes a byte to this PacketStream instance.

WriteBytes ( byte Buffer ) : void

Writes a block of bytes to this PacketStream instance.

WriteDouble ( double Value ) : void

Writes a 64 bit double to this PacketStream instance.

WriteHeader ( ) : void

Writes the packet header.

WriteInt32 ( int Value ) : void

Writes a 32 bit integer to this PacketStream instance.

WriteInt64 ( long Value ) : void

Writes a 64 bit integer to this PacketStream instance.

WriteString ( string Str ) : void
WriteUInt16 ( ushort Value ) : void

Writes an unsigned short to this PacketStream instance.

WriteUInt64 ( ulong Value ) : void

Writes an unsigned 64 bit integer to this PacketStream instance.

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

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

Flushes the underlying stream.
public Flush ( ) : void
Результат void

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

Constructs a new PacketStream instance to write to.
public PacketStream ( byte ID, int Length ) : System
ID byte The ID of this PacketStream instance.
Length int The length of this PacketStream instance (0 if variable length).
Результат System

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

Constructs a new PacketStream instance to read from.
public PacketStream ( byte ID, int Length, byte DataBuffer ) : System
ID byte The ID of this PacketStream instance.
Length int The length of this PacketStream instance.
DataBuffer byte The buffer from which to create this PacketStream instance.
Результат System

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

Peeks a byte from the stream at the current position.
public PeekByte ( ) : byte
Результат byte

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

Peeks a byte from the stream at the specified position.
public PeekByte ( int Position ) : byte
Position int The position to peek at.
Результат byte

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

Peeks an int from the stream at the specified position.
public PeekInt ( int Position ) : int
Position int The position to peek at.
Результат int

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

Peeks a ushort from the stream at the specified position.
public PeekUShort ( int Position ) : ushort
Position int The position to peek at.
Результат ushort

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

Reads a specific number of bytes from this PacketStream.
public Read ( byte buffer, int offset, int count ) : int
buffer byte The buffer to read into.
offset int The zero-based byte offset in buffer at which to begin storing data from the current stream.
count int The number of bytes to read (must be at least equal to the length of buffer!)
Результат int

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

Reads a byte from this PacketStream instance.
public ReadByte ( ) : int
Результат int

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

Reads a specific number of bytes from this PacketStream.
public ReadBytes ( int NumBytes ) : byte[]
NumBytes int Number of bytes to read.
Результат byte[]

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

Reads a double from this PacketStream instance.
public ReadDouble ( ) : double
Результат double

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

Reads an integer from this PacketStream instance.
public ReadInt32 ( ) : int
Результат int

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

Reads a long integer from this PacketStream instance.
public ReadInt64 ( ) : long
Результат long

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

Reads a string from this PacketStream instance.
public ReadString ( ) : string
Результат string

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

Reads a string from this PacketStream instance.
public ReadString ( int NumChars ) : string
NumChars int
Результат string

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

Reads a short from this PacketStream instance.
public ReadUInt16 ( ) : ushort
Результат ushort

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

Reads an unsigned long integer from this PacketStream instance.
public ReadUInt64 ( ) : ulong
Результат ulong

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

Reads a ushort from this PacketStream instance.
public ReadUShort ( ) : ushort
Результат ushort

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

Do not call this! It will throw a NotImplementedException!
public Seek ( long offset, SeekOrigin origin ) : long
offset long The offset to seek to.
origin SeekOrigin The origin of the seek.
Результат long

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

Sets the length of this PacketStream to the specified value.
public SetLength ( long value ) : void
value long The length of the stream.
Результат void

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

Creates an array of bytes with the data in this PacketStream instance.
public ToArray ( ) : byte[]
Результат byte[]

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

Writes a block of bytes to this PacketStream instance.
public Write ( byte buffer, int offset, int count ) : void
buffer byte The data to write.
offset int The offset at which to start writing.
count int The maximum number of bytes to write.
Результат void

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

Writes a byte to this PacketStream instance.
public WriteByte ( byte Value ) : void
Value byte The byte to write.
Результат void

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

Writes a block of bytes to this PacketStream instance.
public WriteBytes ( byte Buffer ) : void
Buffer byte The data to write.
Результат void

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

Writes a 64 bit double to this PacketStream instance.
public WriteDouble ( double Value ) : void
Value double The 64 bit double to write.
Результат void

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

Writes the packet header.
public WriteHeader ( ) : void
Результат void

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

Writes a 32 bit integer to this PacketStream instance.
public WriteInt32 ( int Value ) : void
Value int The 32 bit integer to write.
Результат void

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

Writes a 64 bit integer to this PacketStream instance.
public WriteInt64 ( long Value ) : void
Value long The 64 bit integer to write.
Результат void

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

public WriteString ( string Str ) : void
Str string
Результат void

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

Writes an unsigned short to this PacketStream instance.
public WriteUInt16 ( ushort Value ) : void
Value ushort The unsigned short to write.
Результат void

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

Writes an unsigned 64 bit integer to this PacketStream instance.
public WriteUInt64 ( ulong Value ) : void
Value ulong The unsigned 64 bit integer to write.
Результат void

Описание свойств

m_BaseStream защищенное свойство

protected MemoryStream,System.IO m_BaseStream
Результат System.IO.MemoryStream

m_Length защищенное свойство

protected int m_Length
Результат int

m_Reader защищенное свойство

protected BinaryReader,System.IO m_Reader
Результат System.IO.BinaryReader

m_VariableLength публичное свойство

public bool m_VariableLength
Результат bool