Table of Contents

Class Serialization

Namespace
Playnite.SDK.Data
Assembly
Playnite.SDK.dll

Represents data serialization utility.

public class Serialization
Inheritance
Serialization
Inherited Members

Methods

AreObjectsEqual(object, object)

Compares two objects using json serialization.

public static bool AreObjectsEqual(object object1, object object2)

Parameters

object1 object
object2 object

Returns

bool

FromJsonFile<T>(string)

Deserialize an object from a file containing JSON string.

public static T FromJsonFile<T>(string filePath) where T : class

Parameters

filePath string

Returns

T

Type Parameters

T

FromJsonStream<T>(Stream)

Deserialize an object from JSON data stream.

public static T FromJsonStream<T>(Stream stream) where T : class

Parameters

stream Stream

Returns

T

Type Parameters

T

FromJson<T>(string)

Deserialize an object from JSON string.

public static T FromJson<T>(string json) where T : class

Parameters

json string

Returns

T

Type Parameters

T

FromTomlFile<T>(string)

Deserialize an object from a file containing TOML string.

public static T FromTomlFile<T>(string filePath) where T : class

Parameters

filePath string

Returns

T

Type Parameters

T

FromToml<T>(string)

Deserialize an object from TOML string.

public static T FromToml<T>(string toml) where T : class

Parameters

toml string

Returns

T

Type Parameters

T

FromYamlFile<T>(string)

Deserialize an object from a file containing YAML string.

public static T FromYamlFile<T>(string filePath) where T : class

Parameters

filePath string

Returns

T

Type Parameters

T

FromYaml<T>(string)

Deserialize an object from YAML string.

public static T FromYaml<T>(string yaml) where T : class

Parameters

yaml string

Returns

T

Type Parameters

T

GetClone<T>(T)

Creates clone of an object using json serialization.

public static T GetClone<T>(T source) where T : class

Parameters

source T

Returns

T

Type Parameters

T

GetClone<T, U>(T)

Creates clone of an object using json serialization.

public static U GetClone<T, U>(T source) where T : class where U : class

Parameters

source T

Returns

U

Type Parameters

T
U

ToJson(object, bool)

Serialize an object to JSON string.

public static string ToJson(object obj, bool formatted = false)

Parameters

obj object
formatted bool

Returns

string

ToJsonStream(object, Stream, bool)

Serialize an object to JSON string written to a stream.

public static void ToJsonStream(object obj, Stream stream, bool formatted = false)

Parameters

obj object
stream Stream
formatted bool

ToYaml(object)

Serialize an object to YAML string.

public static string ToYaml(object obj)

Parameters

obj object

Returns

string

TryFromJsonFile<T>(string, out T)

Tries to deserialize an object from JSON file.

public static bool TryFromJsonFile<T>(string filePath, out T content) where T : class

Parameters

filePath string
content T

Returns

bool

Type Parameters

T

TryFromJsonFile<T>(string, out T, out Exception)

Tries to deserialize an object from JSON file.

public static bool TryFromJsonFile<T>(string filePath, out T content, out Exception error) where T : class

Parameters

filePath string
content T
error Exception

Returns

bool

Type Parameters

T

TryFromJsonStream<T>(Stream, out T)

Tries to deserialize an object from JSON data stream.

public static bool TryFromJsonStream<T>(Stream stream, out T content) where T : class

Parameters

stream Stream
content T

Returns

bool

Type Parameters

T

TryFromJsonStream<T>(Stream, out T, out Exception)

Tries to deserialize an object from JSON data stream.

public static bool TryFromJsonStream<T>(Stream stream, out T content, out Exception error) where T : class

Parameters

stream Stream
content T
error Exception

Returns

bool

Type Parameters

T

TryFromJson<T>(string, out T)

Tries to deserialize an object from JSON string.

public static bool TryFromJson<T>(string json, out T content) where T : class

Parameters

json string
content T

Returns

bool

Type Parameters

T

TryFromJson<T>(string, out T, out Exception)

Tries to deserialize an object from JSON string.

public static bool TryFromJson<T>(string json, out T content, out Exception error) where T : class

Parameters

json string
content T
error Exception

Returns

bool

Type Parameters

T

TryFromTomlFile<T>(string, out T)

Tries to deserialize an object from TOML file.

public static bool TryFromTomlFile<T>(string filePath, out T content) where T : class

Parameters

filePath string
content T

Returns

bool

Type Parameters

T

TryFromTomlFile<T>(string, out T, out Exception)

Tries to deserialize an object from TOML file.

public static bool TryFromTomlFile<T>(string filePath, out T content, out Exception error) where T : class

Parameters

filePath string
content T
error Exception

Returns

bool

Type Parameters

T

TryFromToml<T>(string, out T)

Tries to deserialize an object from TOML string.

public static bool TryFromToml<T>(string toml, out T content) where T : class

Parameters

toml string
content T

Returns

bool

Type Parameters

T

TryFromToml<T>(string, out T, out Exception)

Tries to deserialize an object from TOML string.

public static bool TryFromToml<T>(string toml, out T content, out Exception error) where T : class

Parameters

toml string
content T
error Exception

Returns

bool

Type Parameters

T

TryFromYamlFile<T>(string, out T)

Tries to deserialize an object from YAML file.

public static bool TryFromYamlFile<T>(string filePath, out T content) where T : class

Parameters

filePath string
content T

Returns

bool

Type Parameters

T

TryFromYamlFile<T>(string, out T, out Exception)

Tries to deserialize an object from YAML file.

public static bool TryFromYamlFile<T>(string filePath, out T content, out Exception error) where T : class

Parameters

filePath string
content T
error Exception

Returns

bool

Type Parameters

T

TryFromYaml<T>(string, out T)

Tries to deserialize an object from YAML string.

public static bool TryFromYaml<T>(string yaml, out T content) where T : class

Parameters

yaml string
content T

Returns

bool

Type Parameters

T

TryFromYaml<T>(string, out T, out Exception)

Tries to deserialize an object from YAML string.

public static bool TryFromYaml<T>(string yaml, out T content, out Exception error) where T : class

Parameters

yaml string
content T
error Exception

Returns

bool

Type Parameters

T