~ruther/NosSmooth

ref: 9b14d09b35b14705624898307b086957af128748 NosSmooth/Core/NosSmooth.Packets/Attributes/PacketIndexAttribute.cs -rw-r--r-- 1.1 KiB
9b14d09b — František Boháček chore: rename parameter serializer error 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
//
//  PacketIndexAttribute.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;

namespace NosSmooth.Packets.Attributes;

/// <summary>
/// Attribute for marking properties in packets with their position in the packet.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
public class PacketIndexAttribute : Attribute
{
    /// <summary>
    /// Initializes a new instance of the <see cref="PacketIndexAttribute"/> class.
    /// </summary>
    /// <param name="index">The position of the property.</param>
    public PacketIndexAttribute(ushort index)
    {
        Index = index;
    }

    /// <summary>
    /// Gets the index of the current property.
    /// </summary>
    public ushort Index { get; }

    /// <summary>
    /// Gets the inner separator used for complex types such as sub packets.
    /// </summary>
    public char? InnerSeparator { get; set; }

    /// <summary>
    /// Gets the separator after this field.
    /// </summary>
    public char? AfterSeparator { get; set; }
}
Do not follow this link