using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Robust.Shared.Network; namespace Robust.Shared.Serialization { public interface IRobustSerializer { void Initialize(); void Serialize(Stream stream, object toSerialize); /// /// Serializes an object with exact known type to skip a type ID header. /// /// /// This is more efficient than because it does not use a few bytes on type ID header. /// Output from this method is not compatible with or vice versa. /// The type argument of the call must also match, obviously. /// /// The stream to write into. /// /// The object to serialize. /// The object MUST have the exact type of /// /// The type of object to serialize. void SerializeDirect(Stream stream, T toSerialize); T Deserialize(Stream stream); /// /// Deserialize side of . /// /// Stream to read from. /// Value that was deserialized. /// Exact type of object to deserialize. void DeserializeDirect(Stream stream, out T value); object Deserialize(Stream stream); bool CanSerialize(Type type); /// /// Searches for a type with a given SerializedName that can be assigned to another type. /// /// object type that it can be assigned to, like a base class or interface. /// The serializedName inside the . /// Type found, if any. Type? FindSerializedType(Type assignableType, string serializedTypeName); Task Handshake(INetChannel sender); event Action ClientHandshakeComplete; } }