~ruther/NosSmooth

ref: 9b3c4959ad3a6b2792f86da54400b960f181788e NosSmooth/Packets/NosSmooth.PacketSerializer/Converters/Special/IStringConverterFactory.cs -rw-r--r-- 1.3 KiB
9b3c4959 — Rutherther feat(packets): add support for st buff vnums with levels 2 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
//
//  IStringConverterFactory.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.Errors;
using NosSmooth.PacketSerializer.Abstractions;
using Remora.Results;

namespace NosSmooth.Packets.Converters.Special;

/// <summary>
/// Converts special types such as enums or lists.
/// </summary>
public interface IStringConverterFactory
{
    /// <summary>
    /// Whether this type converter should handle the given type.
    /// </summary>
    /// <param name="type">The type to handle.</param>
    /// <returns>Whether the type should be handled.</returns>
    public bool ShouldHandle(Type type);

    /// <summary>
    /// Create converter for the given type.
    /// </summary>
    /// <param name="type">The type to create converter for.</param>
    /// <returns>The type converter or an error.</returns>
    public Result<IStringConverter> CreateTypeSerializer(Type type);

    /// <summary>
    /// Create generic converter for the given type.
    /// </summary>
    /// <typeparam name="T">The type to create converter for.</typeparam>
    /// <returns>The type converter or an error.</returns>
    public Result<IStringConverter<T>> CreateTypeSerializer<T>();
}
Do not follow this link