~ruther/NosSmooth

ref: c076813783b2051c6bdf20dd8862d4e322ec88ef NosSmooth/Packets/NosSmooth.PacketSerializer.Abstractions/Attributes/PacketHeaderAttribute.cs -rw-r--r-- 1.2 KiB
c0768137 — František Boháček feat: split packets definitions into separate assembly 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
//
//  PacketHeaderAttribute.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.

namespace NosSmooth.PacketSerializer.Abstractions.Attributes;

/// <summary>
/// Attribute for specifying the header identifier of the packet.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class PacketHeaderAttribute : Attribute
{
    /// <summary>
    /// Initializes a new instance of the <see cref="PacketHeaderAttribute"/> class.
    /// </summary>
    /// <param name="identifier">The packet identifier (the first entry).</param>
    /// <param name="source">The source of the packet.</param>
    public PacketHeaderAttribute(string? identifier, PacketSource source)
    {
        Identifier = identifier;
        Source = source;
    }

    /// <summary>
    /// Gets the identifier of the packet (the first entry in the packet).
    /// </summary>
    public string? Identifier { get; }

    /// <summary>
    /// Gets the source of the packet used for determining where the packet is from.
    /// </summary>
    public PacketSource Source { get; }
}
Do not follow this link