C# Class GonzoNet.PacketStream

A readable and writable packet.
Inheritance: Stream
Afficher le fichier Open project: RHY3756547/FreeSO Class Usage Examples

Méthodes publiques

Свойство Type Description
m_VariableLength bool

Protected Properties

Свойство Type Description
m_BaseStream System.IO.MemoryStream
m_Length int
m_Reader System.IO.BinaryReader

Méthodes publiques

Méthode Description
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.

Method Details

Flush() public méthode

Flushes the underlying stream.
public Flush ( ) : void
Résultat void

PacketStream() public méthode

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).
Résultat System

PacketStream() public méthode

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.
Résultat System

PeekByte() public méthode

Peeks a byte from the stream at the current position.
public PeekByte ( ) : byte
Résultat byte

PeekByte() public méthode

Peeks a byte from the stream at the specified position.
public PeekByte ( int Position ) : byte
Position int The position to peek at.
Résultat byte

PeekInt() public méthode

Peeks an int from the stream at the specified position.
public PeekInt ( int Position ) : int
Position int The position to peek at.
Résultat int

PeekUShort() public méthode

Peeks a ushort from the stream at the specified position.
public PeekUShort ( int Position ) : ushort
Position int The position to peek at.
Résultat ushort

Read() public méthode

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!)
Résultat int

ReadByte() public méthode

Reads a byte from this PacketStream instance.
public ReadByte ( ) : int
Résultat int

ReadBytes() public méthode

Reads a specific number of bytes from this PacketStream.
public ReadBytes ( int NumBytes ) : byte[]
NumBytes int Number of bytes to read.
Résultat byte[]

ReadDouble() public méthode

Reads a double from this PacketStream instance.
public ReadDouble ( ) : double
Résultat double

ReadInt32() public méthode

Reads an integer from this PacketStream instance.
public ReadInt32 ( ) : int
Résultat int

ReadInt64() public méthode

Reads a long integer from this PacketStream instance.
public ReadInt64 ( ) : long
Résultat long

ReadString() public méthode

Reads a string from this PacketStream instance.
public ReadString ( ) : string
Résultat string

ReadString() public méthode

Reads a string from this PacketStream instance.
public ReadString ( int NumChars ) : string
NumChars int
Résultat string

ReadUInt16() public méthode

Reads a short from this PacketStream instance.
public ReadUInt16 ( ) : ushort
Résultat ushort

ReadUInt64() public méthode

Reads an unsigned long integer from this PacketStream instance.
public ReadUInt64 ( ) : ulong
Résultat ulong

ReadUShort() public méthode

Reads a ushort from this PacketStream instance.
public ReadUShort ( ) : ushort
Résultat ushort

Seek() public méthode

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.
Résultat long

SetLength() public méthode

Sets the length of this PacketStream to the specified value.
public SetLength ( long value ) : void
value long The length of the stream.
Résultat void

ToArray() public méthode

Creates an array of bytes with the data in this PacketStream instance.
public ToArray ( ) : byte[]
Résultat byte[]

Write() public méthode

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.
Résultat void

WriteByte() public méthode

Writes a byte to this PacketStream instance.
public WriteByte ( byte Value ) : void
Value byte The byte to write.
Résultat void

WriteBytes() public méthode

Writes a block of bytes to this PacketStream instance.
public WriteBytes ( byte Buffer ) : void
Buffer byte The data to write.
Résultat void

WriteDouble() public méthode

Writes a 64 bit double to this PacketStream instance.
public WriteDouble ( double Value ) : void
Value double The 64 bit double to write.
Résultat void

WriteHeader() public méthode

Writes the packet header.
public WriteHeader ( ) : void
Résultat void

WriteInt32() public méthode

Writes a 32 bit integer to this PacketStream instance.
public WriteInt32 ( int Value ) : void
Value int The 32 bit integer to write.
Résultat void

WriteInt64() public méthode

Writes a 64 bit integer to this PacketStream instance.
public WriteInt64 ( long Value ) : void
Value long The 64 bit integer to write.
Résultat void

WriteString() public méthode

public WriteString ( string Str ) : void
Str string
Résultat void

WriteUInt16() public méthode

Writes an unsigned short to this PacketStream instance.
public WriteUInt16 ( ushort Value ) : void
Value ushort The unsigned short to write.
Résultat void

WriteUInt64() public méthode

Writes an unsigned 64 bit integer to this PacketStream instance.
public WriteUInt64 ( ulong Value ) : void
Value ulong The unsigned 64 bit integer to write.
Résultat void

Property Details

m_BaseStream protected_oe property

protected MemoryStream,System.IO m_BaseStream
Résultat System.IO.MemoryStream

m_Length protected_oe property

protected int m_Length
Résultat int

m_Reader protected_oe property

protected BinaryReader,System.IO m_Reader
Résultat System.IO.BinaryReader

m_VariableLength public_oe property

public bool m_VariableLength
Résultat bool