~ruther/NosSmooth

ref: 1b7ad333ea54fd9e46dc20b9adcd478f315ed1b0 NosSmooth/Core/NosSmooth.Core/Packets/IPacketSerializer.cs -rw-r--r-- 1.4 KiB
1b7ad333 — František Boháček chore: add documentation for move packet 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
//  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 System;
using NosCore.Packets;
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);

    /// <summary>
    /// Gets the inner serializer from NosCore.
    /// </summary>
    [Obsolete("May be removed anytime.")]
    public Serializer Serializer { get; }

    /// <summary>
    /// Gets the inner deserializer from NosCore.
    /// </summary>
    [Obsolete("May be removed anytime.")]
    public Deserializer Deserializer { get; }
}
Do not follow this link