Photon Quantum 3.0.0

Static Public Member Functions | List of all members
Quantum.IAssetSerializerExtensions Class Reference

An extension class for IAssetSerializer. More...

Static Public Member Functions

static T AssetFromByteArray< T > (this IAssetSerializer serializer, byte[] data)
 Deserializes a single asset from the specified byte array. More...
 
static AssetObject[] AssetsFromByteArray (this IAssetSerializer serializer, byte[] data)
 Deserializes an array of asset objects from the specified byte array. More...
 
static byte[] AssetsToByteArray (this IAssetSerializer serializer, AssetObject[] assets)
 Converts an array of assets to a byte array. More...
 
static byte[] AssetToByteArray (this IAssetSerializer serializer, AssetObject asset)
 Converts an asset object to a byte array. More...
 
static T CloneConfig< T > (this IAssetSerializer serializer, T obj)
 Clones the runtime configuration. More...
 
static T ClonePlayer< T > (this IAssetSerializer serializer, T obj)
 Clones the runtime player. More...
 
static T ConfigFromByteArray< T > (this IAssetSerializer serializer, byte[] data, bool compressed=false)
 Deserializes the runtime configuration from a byte array. May return null. More...
 
static T ConfigFromByteArray< T > (this IAssetSerializer serializer, byte[] data, int offset, int length, bool compressed=false)
 Deserializes the runtime configuration from a byte array with specified offset and length. More...
 
static byte[] ConfigToByteArray< T > (this IAssetSerializer serializer, T obj, bool compress=false)
 Converts the runtime configuration to a byte array. More...
 
static T DeserializeConfig< T > (this IAssetSerializer serializer, BitStream bitStream)
 Deserializes the runtime configuration from a BitStream. May return null. More...
 
static T DeserializePlayer< T > (this IAssetSerializer serializer, BitStream bitStream)
 Deserializes the runtime player from a BitStream. May return null. More...
 
static T PlayerFromByteArray< T > (this IAssetSerializer serializer, byte[] data, bool compressed=false)
 Deserializes the runtime player from a byte array. May return null. More...
 
static T PlayerFromByteArray< T > (this IAssetSerializer serializer, byte[] data, int offset, int length, bool compressed=false)
 Deserializes the runtime player from a byte array with specified offset and length. More...
 
static byte[] PlayerToByteArray< T > (this IAssetSerializer serializer, T obj, bool compress=false)
 Converts the runtime player to a byte array. More...
 
static T ResultFromByteArray< T > (this IAssetSerializer serializer, byte[] data, bool compressed=false)
 Deserializes the game result from a byte array. May return null. More...
 
static T ResultFromByteArray< T > (this IAssetSerializer serializer, byte[] data, int offset, int length, bool compressed=false)
 Deserializes the game result from a byte array with specified offset and length. More...
 
static byte[] ResultToByteArray< T > (this IAssetSerializer serializer, T obj, bool compress=false)
 Converts the game result to a byte array. More...
 
static void SerializeConfig< T > (this IAssetSerializer serializer, BitStream bitStream, T config)
 Serializes the runtime configuration to a BitStream. Handles null values. More...
 
static void SerializePlayer< T > (this IAssetSerializer serializer, BitStream bitStream, T player)
 Serializes the runtime player to a BitStream. Handles null values. More...
 

Detailed Description

An extension class for IAssetSerializer.

Member Function Documentation

◆ SerializeConfig< T >()

static void Quantum.IAssetSerializerExtensions.SerializeConfig< T > ( this IAssetSerializer  serializer,
BitStream  bitStream,
config 
)
inlinestatic

Serializes the runtime configuration to a BitStream. Handles null values.

Template Parameters
TThe type of the runtime configuration.
Parameters
serializerThe asset serializer.
bitStreamThe bit stream to serialize to.
configThe runtime configuration to serialize.
Type Constraints
T :IRuntimeConfig 

◆ DeserializeConfig< T >()

static T Quantum.IAssetSerializerExtensions.DeserializeConfig< T > ( this IAssetSerializer  serializer,
BitStream  bitStream 
)
inlinestatic

Deserializes the runtime configuration from a BitStream. May return null.

Template Parameters
TThe type of the runtime configuration.
Parameters
serializerThe asset serializer.
bitStreamThe bit stream to deserialize from.
Returns
The deserialized runtime configuration.
Type Constraints
T :IRuntimeConfig 

◆ CloneConfig< T >()

static T Quantum.IAssetSerializerExtensions.CloneConfig< T > ( this IAssetSerializer  serializer,
obj 
)
inlinestatic

Clones the runtime configuration.

Template Parameters
TThe type of the runtime configuration.
Parameters
serializerThe asset serializer.
objThe runtime configuration to clone.
Returns
A cloned instance of the runtime configuration.

This method clones the specified runtime configuration by serializing it to a memory stream and then deserializing it back.

Type Constraints
T :IRuntimeConfig 

◆ ConfigToByteArray< T >()

static byte [] Quantum.IAssetSerializerExtensions.ConfigToByteArray< T > ( this IAssetSerializer  serializer,
obj,
bool  compress = false 
)
inlinestatic

Converts the runtime configuration to a byte array.

Template Parameters
TThe type of the runtime configuration.
Parameters
serializerThe asset serializer.
objThe runtime configuration to convert.
compressSpecifies whether to compress the byte array.
Returns
A byte array representation of the runtime configuration.
Type Constraints
T :IRuntimeConfig 

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

static T Quantum.IAssetSerializerExtensions.ConfigFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data,
bool  compressed = false 
)
inlinestatic

Deserializes the runtime configuration from a byte array. May return null.

Template Parameters
TThe type of the runtime configuration.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
compressedSpecifies whether the byte array is compressed.
Returns
The deserialized runtime configuration.
Type Constraints
T :IRuntimeConfig 

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

static T Quantum.IAssetSerializerExtensions.ConfigFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data,
int  offset,
int  length,
bool  compressed = false 
)
inlinestatic

Deserializes the runtime configuration from a byte array with specified offset and length.

Template Parameters
TThe type of the runtime configuration.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
offsetThe starting offset in the byte array.
lengthThe length of the data to deserialize.
compressedSpecifies whether the byte array is compressed.
Returns
The deserialized runtime configuration.
Type Constraints
T :IRuntimeConfig 

◆ SerializePlayer< T >()

static void Quantum.IAssetSerializerExtensions.SerializePlayer< T > ( this IAssetSerializer  serializer,
BitStream  bitStream,
player 
)
inlinestatic

Serializes the runtime player to a BitStream. Handles null values.

Template Parameters
TThe type of the runtime player.
Parameters
serializerThe asset serializer.
bitStreamThe bit stream to serialize to.
playerThe runtime player to serialize.
Type Constraints
T :IRuntimePlayer 

◆ DeserializePlayer< T >()

static T Quantum.IAssetSerializerExtensions.DeserializePlayer< T > ( this IAssetSerializer  serializer,
BitStream  bitStream 
)
inlinestatic

Deserializes the runtime player from a BitStream. May return null.

Template Parameters
TThe type of the runtime player.
Parameters
serializerThe asset serializer.
bitStreamThe bit stream to deserialize from.
Returns
The deserialized runtime player.
Type Constraints
T :IRuntimePlayer 

◆ ClonePlayer< T >()

static T Quantum.IAssetSerializerExtensions.ClonePlayer< T > ( this IAssetSerializer  serializer,
obj 
)
inlinestatic

Clones the runtime player.

Template Parameters
TThe type of the runtime player.
Parameters
serializerThe asset serializer.
objThe runtime player to clone.
Returns
A cloned instance of the runtime player.

This method clones the specified runtime player by serializing it to a memory stream and then deserializing it back.

Type Constraints
T :IRuntimePlayer 

◆ PlayerToByteArray< T >()

static byte [] Quantum.IAssetSerializerExtensions.PlayerToByteArray< T > ( this IAssetSerializer  serializer,
obj,
bool  compress = false 
)
inlinestatic

Converts the runtime player to a byte array.

Template Parameters
TThe type of the runtime player.
Parameters
serializerThe asset serializer.
objThe runtime player to convert.
compressSpecifies whether to compress the byte array.
Returns
A byte array representation of the runtime player.
Type Constraints
T :IRuntimePlayer 

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

static T Quantum.IAssetSerializerExtensions.PlayerFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data,
bool  compressed = false 
)
inlinestatic

Deserializes the runtime player from a byte array. May return null.

Template Parameters
TThe type of the runtime player.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
compressedSpecifies whether the byte array is compressed.
Returns
The deserialized runtime player.
Type Constraints
T :IRuntimePlayer 

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

static T Quantum.IAssetSerializerExtensions.PlayerFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data,
int  offset,
int  length,
bool  compressed = false 
)
inlinestatic

Deserializes the runtime player from a byte array with specified offset and length.

Template Parameters
TThe type of the runtime player.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
offsetThe starting offset in the byte array.
lengthThe length of the data to deserialize.
compressedSpecifies whether the byte array is compressed.
Returns
The deserialized runtime player.
Type Constraints
T :IRuntimePlayer 

◆ ResultToByteArray< T >()

static byte [] Quantum.IAssetSerializerExtensions.ResultToByteArray< T > ( this IAssetSerializer  serializer,
obj,
bool  compress = false 
)
inlinestatic

Converts the game result to a byte array.

Template Parameters
TThe type of the game result.
Parameters
serializerThe asset serializer.
objThe game result to convert.
compressSpecifies whether to compress the byte array.
Returns
A byte array representation of the game result.
Type Constraints
T :IGameResult 

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

static T Quantum.IAssetSerializerExtensions.ResultFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data,
bool  compressed = false 
)
inlinestatic

Deserializes the game result from a byte array. May return null.

Template Parameters
TThe type of the game result.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
compressedSpecifies whether the byte array is compressed.
Returns
The deserialized game result.
Type Constraints
T :IGameResult 

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

static T Quantum.IAssetSerializerExtensions.ResultFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data,
int  offset,
int  length,
bool  compressed = false 
)
inlinestatic

Deserializes the game result from a byte array with specified offset and length.

Template Parameters
TThe type of the game result.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
offsetThe starting offset in the byte array.
lengthThe length of the data to deserialize.
compressedSpecifies whether the byte array is compressed.
Returns
The deserialized game result.
Type Constraints
T :IGameResult 

◆ AssetsFromByteArray()

static AssetObject [] Quantum.IAssetSerializerExtensions.AssetsFromByteArray ( this IAssetSerializer  serializer,
byte[]  data 
)
inlinestatic

Deserializes an array of asset objects from the specified byte array.

Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
Returns
An array of asset objects.

◆ AssetsToByteArray()

static byte [] Quantum.IAssetSerializerExtensions.AssetsToByteArray ( this IAssetSerializer  serializer,
AssetObject[]  assets 
)
inlinestatic

Converts an array of assets to a byte array.

Parameters
serializerThe asset serializer.
assetsThe array of asset objects to serialize.
Returns
A byte array representation ofthe asset array.

◆ AssetFromByteArray< T >()

static T Quantum.IAssetSerializerExtensions.AssetFromByteArray< T > ( this IAssetSerializer  serializer,
byte[]  data 
)
inlinestatic

Deserializes a single asset from the specified byte array.

Template Parameters
TThe type of the asset object.
Parameters
serializerThe asset serializer.
dataThe byte array to deserialize from.
Returns
The deserialized asset object.
Type Constraints
T :AssetObject 

◆ AssetToByteArray()

static byte [] Quantum.IAssetSerializerExtensions.AssetToByteArray ( this IAssetSerializer  serializer,
AssetObject  asset 
)
inlinestatic

Converts an asset object to a byte array.

Parameters
serializerThe asset serializer.
assetThe asset object to serialize.
Returns
A byte array representation of the asset.