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
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Parameters.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.PacketSerializersGenerator.Data;
/// <summary>
/// Contains set of parameters of a packet.
/// </summary>
public class Parameters
{
/// <summary>
/// Initializes a new instance of the <see cref="Parameters"/> class.
/// </summary>
/// <param name="parameters">The list of the parameters.</param>
public Parameters(IReadOnlyList<ParameterInfo> parameters)
{
List = parameters;
}
/// <summary>
/// Gets the list of the parameters.
/// </summary>
public IReadOnlyList<ParameterInfo> List { get; }
/// <summary>
/// Gets the current index of the parameter.
/// </summary>
public int CurrentIndex { get; set; }
/// <summary>
/// Gets the currently processing parameter.
/// </summary>
public ParameterInfo Current => List[CurrentIndex];
/// <summary>
/// Gets the next processing parameter.
/// </summary>
public ParameterInfo Next => List[CurrentIndex];
/// <summary>
/// Gets the previous processing parameter.
/// </summary>
public ParameterInfo Previous => List[CurrentIndex];
/// <summary>
/// Gets whether the current parameter is the last one.
/// </summary>
public bool IsLast => CurrentIndex == List.Count - 1;
/// <summary>
/// Gets whether the current parameter is the first one.
/// </summary>
public bool IsFirst => CurrentIndex == 0;
}