C# Class Lidgren.Network.NetBuffer

Mostrar archivo Open project: Fr0sZ/Skylines-Multiplayer Class Usage Examples

Public Methods

Method Description
EnsureBufferSize ( int numberOfBits ) : void

Ensures the buffer can hold this number of bits

ReadAllFields ( object target ) : void

Reads all public and private declared instance fields of the object in alphabetical order using reflection

ReadAllFields ( object target, BindingFlags flags ) : void

Reads all fields with the specified binding of the object in alphabetical order using reflection

ReadAllProperties ( object target ) : void

Reads all public and private declared instance fields of the object in alphabetical order using reflection

ReadAllProperties ( object target, BindingFlags flags ) : void

Reads all fields with the specified binding of the object in alphabetical order using reflection

ReadBits ( byte into, int offset, int numberOfBits ) : void

Reads the specified number of bits into a preallocated array

ReadBoolean ( ) : bool

Reads a boolean value (stored as a single bit) written using Write(bool)

ReadByte ( byte &result ) : bool

Reads a byte and returns true or false for success

ReadByte ( ) : byte

Reads a byte

ReadByte ( int numberOfBits ) : byte

Reads 1 to 8 bits into a byte

ReadBytes ( int numberOfBytes, byte &result ) : bool

Reads the specified number of bytes and returns true for success

ReadBytes ( int numberOfBytes ) : byte[]

Reads the specified number of bytes

ReadBytes ( byte into, int offset, int numberOfBytes ) : void

Reads the specified number of bytes into a preallocated array

ReadDouble ( ) : double

Reads a 64 bit floating point value written using Write(Double)

ReadFloat ( ) : float

Reads a 32 bit floating point value written using Write(Single)

ReadIPEndPoint ( ) : IPEndPoint

Reads a stored IPv4 endpoint description

ReadInt16 ( ) : Int16

Reads a 16 bit signed integer written using Write(Int16)

ReadInt32 ( ) : Int32

Reads a 32 bit signed integer written using Write(Int32)

ReadInt32 ( int numberOfBits ) : Int32

Reads a signed integer stored in 1 to 32 bits, written using Write(Int32, Int32)

ReadInt64 ( ) : System.Int64

Reads a 64 bit signed integer written using Write(Int64)

ReadInt64 ( int numberOfBits ) : System.Int64

Reads a signed integer stored in 1 to 64 bits, written using Write(Int64, Int32)

ReadPadBits ( ) : void

Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.

ReadRangedInteger ( int min, int max ) : int

Reads a 32 bit integer value written using WriteRangedInteger()

ReadRangedSingle ( float min, float max, int numberOfBits ) : float

Reads a 32 bit floating point value written using WriteRangedSingle()

ReadSignedSingle ( int numberOfBits ) : float

Reads a 32 bit floating point value written using WriteSignedSingle()

ReadSingle ( float &result ) : bool

Reads a 32 bit floating point value written using Write(Single)

ReadSingle ( ) : float

Reads a 32 bit floating point value written using Write(Single)

ReadString ( string &result ) : bool

Reads a string written using Write(string) and returns true for success

ReadString ( ) : string

Reads a string written using Write(string)

ReadTime ( NetConnection connection, bool highPrecision ) : double

Reads a value, in local time comparable to NetTime.Now, written using WriteTime() for the connection supplied

ReadUnitSingle ( int numberOfBits ) : float

Reads a 32 bit floating point value written using WriteUnitSingle()

ReadVariableInt32 ( ) : int

Reads a variable sized Int32 written using WriteVariableInt32()

ReadVariableInt64 ( ) : System.Int64

Reads a variable sized Int64 written using WriteVariableInt64()

ReadVector3 ( ) : System.Vector3

SkipPadBits ( ) : void

Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.

SkipPadBits ( int numberOfBits ) : void

Pads data with the specified number of bits.

Write ( IPEndPoint endPoint ) : void

Writes an endpoint description

Write ( Int16 source ) : void

Writes a signed 16 bit integer

Write ( Int32 source ) : void

Writes a 32 bit signed integer

Write ( Int32 source, int numberOfBits ) : void

Writes a signed integer using 1 to 32 bits

Write ( System.Int64 source ) : void

Writes a 64 bit signed integer

Write ( System.Int64 source, int numberOfBits ) : void

Writes a signed integer using 1 to 64 bits

Write ( NetBuffer buffer ) : void

Append all the bits of message to this message

Write ( UInt32 source ) : void

Writes a 32 bit unsigned integer

Write ( System.Vector3 source ) : void

Writes a 32 bit floating point value

Write ( bool value ) : void

Writes a boolean value using 1 bit

Write ( byte source ) : void

Write a byte

Write ( byte source, int numberOfBits ) : void

Writes 1 to 8 bits of a byte

Write ( byte source, int offsetInBytes, int numberOfBytes ) : void

Writes the specified number of bytes from an array

Write ( double source ) : void

Writes a 64 bit floating point value

Write ( float source ) : void

Writes a 32 bit floating point value

Write ( string source ) : void

Write a string

WriteAllFields ( object ob ) : void

Writes all public and private declared instance fields of the object in alphabetical order using reflection

WriteAllFields ( object ob, BindingFlags flags ) : void

Writes all fields with specified binding in alphabetical order using reflection

WriteAllProperties ( object ob ) : void

Writes all public and private declared instance properties of the object in alphabetical order using reflection

WriteAllProperties ( object ob, BindingFlags flags ) : void

Writes all properties with specified binding in alphabetical order using reflection

WriteAt ( Int32 offset, Int16 source ) : void

Writes a 16 bit signed integer at a given offset in the buffer

WriteAt ( Int32 offset, Int32 source ) : void

Writes a 32 bit signed integer at a given offset in the buffer

WritePadBits ( ) : void

Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.

WritePadBits ( int numberOfBits ) : void

Pads data with the specified number of bits.

WriteRangedInteger ( int min, int max, int value ) : int

Writes an integer with the least amount of bits need for the specified range Returns number of bits written

WriteRangedSingle ( float value, float min, float max, int numberOfBits ) : void

Compress a float within a specified range using a certain number of bits

WriteSignedSingle ( float value, int numberOfBits ) : void

Compress (lossy) a float in the range -1..1 using numberOfBits bits

WriteTime ( bool highPrecision ) : void

Writes the current local time to a message; readable (and convertable to local time) by the remote host using ReadTime()

WriteTime ( double localTime, bool highPrecision ) : void

Writes a local timestamp to a message; readable (and convertable to local time) by the remote host using ReadTime()

WriteUnitSingle ( float value, int numberOfBits ) : void

Compress (lossy) a float in the range 0..1 using numberOfBits bits

WriteVariableInt32 ( int value ) : int

Write Base128 encoded variable sized signed integer of up to 32 bits

WriteVariableInt64 ( System.Int64 value ) : int

Write Base128 encoded variable sized signed integer of up to 64 bits

Private Methods

Method Description
InternalEnsureBufferSize ( int numberOfBits ) : void

Ensures the buffer can hold this number of bits

ReadInt32 ( Int32 &result ) : bool
ReadSByte ( ) : sbyte
ReadUInt16 ( ) : UInt16
ReadUInt32 ( ) : UInt32
ReadUInt32 ( int numberOfBits ) : UInt32
ReadUInt32 ( UInt32 &result ) : bool
ReadUInt64 ( ) : System.UInt64
ReadUInt64 ( int numberOfBits ) : System.UInt64
ReadVariableUInt32 ( uint &result ) : bool
ReadVariableUInt32 ( ) : uint
ReadVariableUInt64 ( ) : System.UInt64
Write ( UInt16 source ) : void
Write ( UInt16 source, int numberOfBits ) : void
Write ( UInt32 source, int numberOfBits ) : void
Write ( System.UInt64 source ) : void
Write ( System.UInt64 source, int numberOfBits ) : void
Write ( sbyte source ) : void
WriteAt ( Int32 offset, UInt16 source ) : void
WriteAt ( Int32 offset, UInt32 source ) : void
WriteAt ( Int32 offset, System.UInt64 source ) : void
WriteVariableUInt32 ( uint value ) : int
WriteVariableUInt64 ( System.UInt64 value ) : int

Method Details

EnsureBufferSize() public method

Ensures the buffer can hold this number of bits
public EnsureBufferSize ( int numberOfBits ) : void
numberOfBits int
return void

ReadAllFields() public method

Reads all public and private declared instance fields of the object in alphabetical order using reflection
public ReadAllFields ( object target ) : void
target object
return void

ReadAllFields() public method

Reads all fields with the specified binding of the object in alphabetical order using reflection
public ReadAllFields ( object target, BindingFlags flags ) : void
target object
flags BindingFlags
return void

ReadAllProperties() public method

Reads all public and private declared instance fields of the object in alphabetical order using reflection
public ReadAllProperties ( object target ) : void
target object
return void

ReadAllProperties() public method

Reads all fields with the specified binding of the object in alphabetical order using reflection
public ReadAllProperties ( object target, BindingFlags flags ) : void
target object
flags BindingFlags
return void

ReadBits() public method

Reads the specified number of bits into a preallocated array
public ReadBits ( byte into, int offset, int numberOfBits ) : void
into byte The destination array
offset int The offset where to start writing in the destination array
numberOfBits int The number of bits to read
return void

ReadBoolean() public method

Reads a boolean value (stored as a single bit) written using Write(bool)
public ReadBoolean ( ) : bool
return bool

ReadByte() public method

Reads a byte and returns true or false for success
public ReadByte ( byte &result ) : bool
result byte
return bool

ReadByte() public method

Reads a byte
public ReadByte ( ) : byte
return byte

ReadByte() public method

Reads 1 to 8 bits into a byte
public ReadByte ( int numberOfBits ) : byte
numberOfBits int
return byte

ReadBytes() public method

Reads the specified number of bytes and returns true for success
public ReadBytes ( int numberOfBytes, byte &result ) : bool
numberOfBytes int
result byte
return bool

ReadBytes() public method

Reads the specified number of bytes
public ReadBytes ( int numberOfBytes ) : byte[]
numberOfBytes int
return byte[]

ReadBytes() public method

Reads the specified number of bytes into a preallocated array
public ReadBytes ( byte into, int offset, int numberOfBytes ) : void
into byte The destination array
offset int The offset where to start writing in the destination array
numberOfBytes int The number of bytes to read
return void

ReadDouble() public method

Reads a 64 bit floating point value written using Write(Double)
public ReadDouble ( ) : double
return double

ReadFloat() public method

Reads a 32 bit floating point value written using Write(Single)
public ReadFloat ( ) : float
return float

ReadIPEndPoint() public method

Reads a stored IPv4 endpoint description
public ReadIPEndPoint ( ) : IPEndPoint
return System.Net.IPEndPoint

ReadInt16() public method

Reads a 16 bit signed integer written using Write(Int16)
public ReadInt16 ( ) : Int16
return System.Int16

ReadInt32() public method

Reads a 32 bit signed integer written using Write(Int32)
public ReadInt32 ( ) : Int32
return System.Int32

ReadInt32() public method

Reads a signed integer stored in 1 to 32 bits, written using Write(Int32, Int32)
public ReadInt32 ( int numberOfBits ) : Int32
numberOfBits int
return System.Int32

ReadInt64() public method

Reads a 64 bit signed integer written using Write(Int64)
public ReadInt64 ( ) : System.Int64
return System.Int64

ReadInt64() public method

Reads a signed integer stored in 1 to 64 bits, written using Write(Int64, Int32)
public ReadInt64 ( int numberOfBits ) : System.Int64
numberOfBits int
return System.Int64

ReadPadBits() public method

Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
public ReadPadBits ( ) : void
return void

ReadRangedInteger() public method

Reads a 32 bit integer value written using WriteRangedInteger()
public ReadRangedInteger ( int min, int max ) : int
min int The minimum value used when writing the value
max int The maximum value used when writing the value
return int

ReadRangedSingle() public method

Reads a 32 bit floating point value written using WriteRangedSingle()
public ReadRangedSingle ( float min, float max, int numberOfBits ) : float
min float The minimum value used when writing the value
max float The maximum value used when writing the value
numberOfBits int The number of bits used when writing the value
return float

ReadSignedSingle() public method

Reads a 32 bit floating point value written using WriteSignedSingle()
public ReadSignedSingle ( int numberOfBits ) : float
numberOfBits int The number of bits used when writing the value
return float

ReadSingle() public method

Reads a 32 bit floating point value written using Write(Single)
public ReadSingle ( float &result ) : bool
result float
return bool

ReadSingle() public method

Reads a 32 bit floating point value written using Write(Single)
public ReadSingle ( ) : float
return float

ReadString() public method

Reads a string written using Write(string) and returns true for success
public ReadString ( string &result ) : bool
result string
return bool

ReadString() public method

Reads a string written using Write(string)
public ReadString ( ) : string
return string

ReadTime() public method

Reads a value, in local time comparable to NetTime.Now, written using WriteTime() for the connection supplied
public ReadTime ( NetConnection connection, bool highPrecision ) : double
connection NetConnection
highPrecision bool
return double

ReadUnitSingle() public method

Reads a 32 bit floating point value written using WriteUnitSingle()
public ReadUnitSingle ( int numberOfBits ) : float
numberOfBits int The number of bits used when writing the value
return float

ReadVariableInt32() public method

Reads a variable sized Int32 written using WriteVariableInt32()
public ReadVariableInt32 ( ) : int
return int

ReadVariableInt64() public method

Reads a variable sized Int64 written using WriteVariableInt64()
public ReadVariableInt64 ( ) : System.Int64
return System.Int64

ReadVector3() public method

public ReadVector3 ( ) : System.Vector3
return System.Vector3

SkipPadBits() public method

Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
public SkipPadBits ( ) : void
return void

SkipPadBits() public method

Pads data with the specified number of bits.
public SkipPadBits ( int numberOfBits ) : void
numberOfBits int
return void

Write() public method

Writes an endpoint description
public Write ( IPEndPoint endPoint ) : void
endPoint System.Net.IPEndPoint
return void

Write() public method

Writes a signed 16 bit integer
public Write ( Int16 source ) : void
source System.Int16
return void

Write() public method

Writes a 32 bit signed integer
public Write ( Int32 source ) : void
source System.Int32
return void

Write() public method

Writes a signed integer using 1 to 32 bits
public Write ( Int32 source, int numberOfBits ) : void
source System.Int32
numberOfBits int
return void

Write() public method

Writes a 64 bit signed integer
public Write ( System.Int64 source ) : void
source System.Int64
return void

Write() public method

Writes a signed integer using 1 to 64 bits
public Write ( System.Int64 source, int numberOfBits ) : void
source System.Int64
numberOfBits int
return void

Write() public method

Append all the bits of message to this message
public Write ( NetBuffer buffer ) : void
buffer NetBuffer
return void

Write() public method

Writes a 32 bit unsigned integer
public Write ( UInt32 source ) : void
source System.UInt32
return void

Write() public method

Writes a 32 bit floating point value
public Write ( System.Vector3 source ) : void
source System.Vector3
return void

Write() public method

Writes a boolean value using 1 bit
public Write ( bool value ) : void
value bool
return void

Write() public method

Write a byte
public Write ( byte source ) : void
source byte
return void

Write() public method

Writes 1 to 8 bits of a byte
public Write ( byte source, int numberOfBits ) : void
source byte
numberOfBits int
return void

Write() public method

Writes the specified number of bytes from an array
public Write ( byte source, int offsetInBytes, int numberOfBytes ) : void
source byte
offsetInBytes int
numberOfBytes int
return void

Write() public method

Writes a 64 bit floating point value
public Write ( double source ) : void
source double
return void

Write() public method

Writes a 32 bit floating point value
public Write ( float source ) : void
source float
return void

Write() public method

Write a string
public Write ( string source ) : void
source string
return void

WriteAllFields() public method

Writes all public and private declared instance fields of the object in alphabetical order using reflection
public WriteAllFields ( object ob ) : void
ob object
return void

WriteAllFields() public method

Writes all fields with specified binding in alphabetical order using reflection
public WriteAllFields ( object ob, BindingFlags flags ) : void
ob object
flags BindingFlags
return void

WriteAllProperties() public method

Writes all public and private declared instance properties of the object in alphabetical order using reflection
public WriteAllProperties ( object ob ) : void
ob object
return void

WriteAllProperties() public method

Writes all properties with specified binding in alphabetical order using reflection
public WriteAllProperties ( object ob, BindingFlags flags ) : void
ob object
flags BindingFlags
return void

WriteAt() public method

Writes a 16 bit signed integer at a given offset in the buffer
public WriteAt ( Int32 offset, Int16 source ) : void
offset System.Int32
source System.Int16
return void

WriteAt() public method

Writes a 32 bit signed integer at a given offset in the buffer
public WriteAt ( Int32 offset, Int32 source ) : void
offset System.Int32
source System.Int32
return void

WritePadBits() public method

Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
public WritePadBits ( ) : void
return void

WritePadBits() public method

Pads data with the specified number of bits.
public WritePadBits ( int numberOfBits ) : void
numberOfBits int
return void

WriteRangedInteger() public method

Writes an integer with the least amount of bits need for the specified range Returns number of bits written
public WriteRangedInteger ( int min, int max, int value ) : int
min int
max int
value int
return int

WriteRangedSingle() public method

Compress a float within a specified range using a certain number of bits
public WriteRangedSingle ( float value, float min, float max, int numberOfBits ) : void
value float
min float
max float
numberOfBits int
return void

WriteSignedSingle() public method

Compress (lossy) a float in the range -1..1 using numberOfBits bits
public WriteSignedSingle ( float value, int numberOfBits ) : void
value float
numberOfBits int
return void

WriteTime() public method

Writes the current local time to a message; readable (and convertable to local time) by the remote host using ReadTime()
public WriteTime ( bool highPrecision ) : void
highPrecision bool
return void

WriteTime() public method

Writes a local timestamp to a message; readable (and convertable to local time) by the remote host using ReadTime()
public WriteTime ( double localTime, bool highPrecision ) : void
localTime double
highPrecision bool
return void

WriteUnitSingle() public method

Compress (lossy) a float in the range 0..1 using numberOfBits bits
public WriteUnitSingle ( float value, int numberOfBits ) : void
value float
numberOfBits int
return void

WriteVariableInt32() public method

Write Base128 encoded variable sized signed integer of up to 32 bits
public WriteVariableInt32 ( int value ) : int
value int
return int

WriteVariableInt64() public method

Write Base128 encoded variable sized signed integer of up to 64 bits
public WriteVariableInt64 ( System.Int64 value ) : int
value System.Int64
return int