//
// PacketSerializer.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 System;
using NosSmooth.Packets.Attributes;
using NosSmooth.Packets.Converters;
using NosSmooth.Packets.Packets;
using Remora.Results;
namespace NosSmooth.Packets;
///
/// Serializer of packets.
///
public class PacketSerializer : IPacketSerializer
{
///
/// Serializes the given object to string by appending to the packet string builder.
///
/// The packet to serialize.
/// A result that may or may not have succeeded.
public Result Serialize(IPacket obj)
{
return Result.FromSuccess("as");
}
///
/// Convert the data from the enumerator to the given type.
///
/// The packet string to deserialize.
/// The preferred source to check first. If packet with the given header is not found there, other sources will be checked as well.
/// The parsed object or an error.
public Result Deserialize(string packetString, PacketSource preferredSource)
{
return Result.FromError(new ArgumentInvalidError("asdf", "asdf"));
}
}