My Project
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
LiteNetLib.Utils.NetSerializer Class Reference

Public Member Functions

void RegisterNestedType< T > ()
 Register custom property type.
 
void RegisterNestedType< T > (Func< T > constructor)
 Register custom property type.
 
void RegisterNestedType< T > (Action< NetDataWriter, T > writer, Func< NetDataReader, T > reader)
 Register custom property type.
 
 NetSerializer (int maxStringLength)
 
void Register< T > ()
 
Exceptions
InvalidTypeExceptionT 's fields are not supported, or it has no fields

 
Deserialize< T > (NetDataReader reader)
 Reads packet with known type.
 
bool Deserialize< T > (NetDataReader reader, T target)
 Reads packet with known type (non alloc variant)
 
void Serialize< T > (NetDataWriter writer, T obj)
 Serialize object to NetDataWriter (fast)
 
byte[] Serialize< T > (T obj)
 Serialize object to byte array.
 

Member Function Documentation

◆ Deserialize< T >() [1/2]

T LiteNetLib.Utils.NetSerializer.Deserialize< T > ( NetDataReader  reader)
inline

Reads packet with known type.

Parameters
readerNetDataReader with packet
Returns
Returns packet if packet in reader is matched type
Exceptions
InvalidTypeExceptionT 's fields are not supported, or it has no fields
Type Constraints
T :class 
T :new() 

◆ Deserialize< T >() [2/2]

bool LiteNetLib.Utils.NetSerializer.Deserialize< T > ( NetDataReader  reader,
target 
)
inline

Reads packet with known type (non alloc variant)

Parameters
readerNetDataReader with packet
targetDeserialization target
Returns
Returns true if packet in reader is matched type
Exceptions
InvalidTypeExceptionT 's fields are not supported, or it has no fields
Type Constraints
T :class 
T :new() 

◆ RegisterNestedType< T >() [1/3]

void LiteNetLib.Utils.NetSerializer.RegisterNestedType< T > ( )
inline

Register custom property type.

Template Parameters
TINetSerializable structure
Type Constraints
T :struct 
T :INetSerializable 

◆ RegisterNestedType< T >() [2/3]

void LiteNetLib.Utils.NetSerializer.RegisterNestedType< T > ( Action< NetDataWriter, T >  writer,
Func< NetDataReader, T >  reader 
)
inline

Register custom property type.

Template Parameters
TAny packet
Parameters
writercustom type writer
readercustom type reader

◆ RegisterNestedType< T >() [3/3]

void LiteNetLib.Utils.NetSerializer.RegisterNestedType< T > ( Func< T >  constructor)
inline

Register custom property type.

Template Parameters
TINetSerializable class
Type Constraints
T :class 
T :INetSerializable 

◆ Serialize< T >() [1/2]

void LiteNetLib.Utils.NetSerializer.Serialize< T > ( NetDataWriter  writer,
obj 
)
inline

Serialize object to NetDataWriter (fast)

Parameters
writerSerialization target NetDataWriter
objObject to serialize
Exceptions
InvalidTypeExceptionT 's fields are not supported, or it has no fields
Type Constraints
T :class 
T :new() 

◆ Serialize< T >() [2/2]

byte[] LiteNetLib.Utils.NetSerializer.Serialize< T > ( obj)
inline

Serialize object to byte array.

Parameters
objObject to serialize
Returns
byte array with serialized data
Type Constraints
T :class 
T :new() 

The documentation for this class was generated from the following file: