~ruther/NosSmooth

ref: 58d8743477820408507f19d1c1ce75b73e23615f NosSmooth/Packets/NosSmooth.PacketSerializer.Abstractions/Attributes/PacketHeaderAttribute.cs -rw-r--r-- 1.2 KiB
58d87434 — Rutherther chore: bump versions 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
//
//  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, AllowMultiple = true)]
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