Table of Contents

Class Utils.ProtoBuf

Namespace
RichHudFramework
Assembly
RichHudClient.dll

Safe wrappers around Space Engineers' built-in ProtoBuf serialization utilities. Catches exceptions and returns them as KnownException instead of letting them propagate.

public static class Utils.ProtoBuf
Inheritance
Utils.ProtoBuf

Methods

TryDeserialize<T>(byte[], out T)

Attempts to deserialize a byte array into an object of the specified type using ProtoBuf.

Wraps MyAPIGateway.Utilities.SerializeFromBinary()

public static KnownException TryDeserialize<T>(byte[] dataIn, out T obj)

Parameters

dataIn byte[]

The byte array containing serialized data.

obj T

Receives the deserialized instance on success; default(T) on failure.

Returns

KnownException

Null on success, otherwise a KnownException describing the failure.

Type Parameters

T

Target type. Must match the type used during serialization.

TrySerialize<T>(T, out byte[])

Attempts to serialize an object to a binary byte array using ProtoBuf.

Wraps MyAPIGateway.Utilities.SerializeToBinary().

public static KnownException TrySerialize<T>(T obj, out byte[] dataOut)

Parameters

obj T

The object instance to serialize.

dataOut byte[]

Receives the serialized byte array on success; null on failure.

Returns

KnownException

Null on success, otherwise a KnownException describing the failure.

Type Parameters

T

Type of the object to serialize. Must be marked [ProtoContract] with members marked [ProtoMember(uniqueID)].