~ruther/NosSmooth

ref: 24c8d2cc70193b8d82a830337060e0aba50f6867 NosSmooth/Core/NosSmooth.Core/Packets/IPacketSerializer.cs -rw-r--r-- 981 bytes
24c8d2cc — František Boháček chore: add stylecop, ensure stylecop rules are met 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
//  IPacketSerializer.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 NosCore.Packets.Interfaces;
using Remora.Results;

namespace NosSmooth.Core.Packets;

/// <summary>
/// Represents serialiazer and deserializer of <see cref="IPacket"/>.
/// </summary>
public interface IPacketSerializer
{
    /// <summary>
    /// Serializes the given <see cref="IPacket"/> into string.
    /// </summary>
    /// <param name="packet">The packet to serialize.</param>
    /// <returns>The serialized packet.</returns>
    public Result<string> Serialize(IPacket packet);

    /// <summary>
    /// Deserializes the given string into <see cref="IPacket"/>.
    /// </summary>
    /// <param name="packetString">The packet to deserialize.</param>
    /// <returns>The deserialized packet.</returns>
    public Result<IPacket> Deserialize(string packetString);
}
Do not follow this link