Class IncomingMessage
This class represents an incoming message.
Namespace: Evergine.Networking.Connection.Messages
Assembly: Evergine.Networking.dll
Syntax
public class IncomingMessage
Constructors
IncomingMessage(NetIncomingMessage)
Initializes a new instance of the IncomingMessage class.
Declaration
public IncomingMessage(NetIncomingMessage message)
Parameters
Type | Name | Description |
---|---|---|
NetIncomingMessage | message | The message. |
Properties
InnerMessage
Gets the inner NetIncomingMessage.
Declaration
public object InnerMessage { get; }
Property Value
Type | Description |
---|---|
object |
LengthBits
Gets the length of the used portion of the buffer in bits.
Declaration
public int LengthBits { get; }
Property Value
Type | Description |
---|---|
int |
LengthBytes
Gets the length of the used portion of the buffer, in bytes.
Declaration
public int LengthBytes { get; }
Property Value
Type | Description |
---|---|
int |
Methods
GetData()
Gets the message data.
Declaration
public byte[] GetData()
Returns
Type | Description |
---|---|
byte[] | The message as a byte array. |
ReadBoolean()
Reads the next Boolean value.
Declaration
public bool ReadBoolean()
Returns
Type | Description |
---|---|
bool | The next Boolean value in the message. |
ReadByte(int)
Reads the next byte (or bits).
Declaration
public byte ReadByte(int numberOfBits = 8)
Parameters
Type | Name | Description |
---|---|---|
int | numberOfBits | The number of bits that should be read; by default 8 bits. |
Returns
Type | Description |
---|---|
byte | The next byte (or bits) in the message. |
Exceptions
Type | Condition |
---|---|
ArgumentException | ReadByte(bits) can only read between 1 and 8 bits. |
ReadBytes()
Reads the bytes of the length of the next integer.
Declaration
public byte[] ReadBytes()
Returns
Type | Description |
---|---|
byte[] | The next byte array. |
ReadColor()
Reads the next Color.
Declaration
public Color ReadColor()
Returns
Type | Description |
---|---|
Color | The next Color in the message. |
ReadDateTime()
Reads the next DateTime value.
Declaration
public DateTime ReadDateTime()
Returns
Type | Description |
---|---|
DateTime | The next DateTime value in the message. |
ReadInt16()
Reads the next Int16.
Declaration
public short ReadInt16()
Returns
Type | Description |
---|---|
short | The next Int16 in the message. |
ReadInt32()
Reads the next Int32.
Declaration
public int ReadInt32()
Returns
Type | Description |
---|---|
int | The next Int32 in the message. |
ReadInt64()
Reads the next Int64.
Declaration
public long ReadInt64()
Returns
Type | Description |
---|---|
long | The next Int64 in the message. |
ReadMatrix3x3()
Reads the next Matrix3x3.
Declaration
public Matrix3x3 ReadMatrix3x3()
Returns
Type | Description |
---|---|
Matrix3x3 | The next Matrix3x3 in the message. |
ReadMatrix4x4()
Reads the next Matrix4x4.
Declaration
public Matrix4x4 ReadMatrix4x4()
Returns
Type | Description |
---|---|
Matrix4x4 | The next Matrix4x4 in the message. |
ReadQuaternion()
Reads the next Quaternion.
Declaration
public Quaternion ReadQuaternion()
Returns
Type | Description |
---|---|
Quaternion | The next Quaternion in the message. |
ReadSingle()
Reads the next single value.
Declaration
public float ReadSingle()
Returns
Type | Description |
---|---|
float | The next single value in the message. |
ReadString()
Reads the next string.
Declaration
public string ReadString()
Returns
Type | Description |
---|---|
string | The next string in the message. |
ReadTimeSpan(bool)
Reads the next TimeSpan.
Declaration
public TimeSpan ReadTimeSpan(bool highPrecision)
Parameters
Type | Name | Description |
---|---|---|
bool | highPrecision | Indicates whether the TimeSpan will be read using high precision (ticks) or not (milliseconds). |
Returns
Type | Description |
---|---|
TimeSpan | The next TimeSpan in the message. |
Remarks
High precision allows the full TimeSpan range; otherwise, it will be limited to "+-24.20:31:23.647" (±24 days, 20 hours, 31 minutes, 23 seconds, and 647 milliseconds).
ReadVector2()
Reads the next Vector2.
Declaration
public Vector2 ReadVector2()
Returns
Type | Description |
---|---|
Vector2 | The next Vector2 in the message. |
ReadVector3()
Reads the next Vector3.
Declaration
public Vector3 ReadVector3()
Returns
Type | Description |
---|---|
Vector3 | The next Vector3 in the message. |
ReadVector4()
Reads the next Vector4.
Declaration
public Vector4 ReadVector4()
Returns
Type | Description |
---|---|
Vector4 | The next Vector4 in the message. |
Seek(int)
Seeks the specified number of offset bytes.
Declaration
public void Seek(int offsetBytes)
Parameters
Type | Name | Description |
---|---|---|
int | offsetBytes | The offset in bytes. |