// // IStringSerializer.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Remora.Results; namespace NosSmooth.PacketSerializer.Abstractions; /// /// Serializer of values from NosTale packet strings. /// public interface IStringSerializer { /// /// Convert the data from the enumerator to the given type. /// /// The type of the object to serialize. /// The packet string enumerator with the current position. /// The deserialization options. /// The parsed object or an error. public Result Deserialize(Type parseType, ref PacketStringEnumerator stringEnumerator, DeserializeOptions options); /// /// Serializes the given object to string by appending to the packet string builder. /// /// The type of the object to serialize. /// The object to serialize. /// The string builder to append to. /// A result that may or may not have succeeded. public Result Serialize(Type parseType, object? obj, ref PacketStringBuilder builder); /// /// Convert the data from the enumerator to the given type. /// /// The packet string enumerator with the current position. /// The type of the object to serialize. /// The deserialization options. /// The parsed object or an error. public Result Deserialize(ref PacketStringEnumerator stringEnumerator, DeserializeOptions options); /// /// Serializes the given object to string by appending to the packet string builder. /// /// The object to serialize. /// The string builder to append to. /// The type of the object to deserialize. /// A result that may or may not have succeeded. public Result Serialize(TParseType? obj, ref PacketStringBuilder builder); }