Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NumberOfInstances.cs
1using System.Diagnostics.CodeAnalysis;
2
4{
8 public class NumberOfInstances : DataObject
9 {
14 : base([])
15 {
16 }
17
23 public NumberOfInstances(byte[] Value, int Count)
24 : base(Value)
25 {
26 this.Count = Count;
27 }
28
32 public override ushort Tag => 0x02;
33
37 public int Count { get; }
38
46 public override bool TryParse(byte[] Value, TravelDocumentsClient Client,
47 [NotNullWhen(true)] out IDataObject? Parsed)
48 {
49 int Count;
50
51 switch (Value.Length)
52 {
53 case 0:
54 Count = 0;
55 break;
56
57 case 1:
58 Count = Value[0];
59 break;
60
61 case 2:
62 Count = Value[0];
63 Count <<= 8;
64 Count |= Value[1];
65 break;
66
67 default:
68 Parsed = null;
69 return false;
70 }
71
72 Parsed = new NumberOfInstances(Value, Count);
73 return true;
74 }
75 }
76}
override bool TryParse(byte[] Value, TravelDocumentsClient Client, [NotNullWhen(true)] out IDataObject? Parsed)
Tries to parse a binary representation of the data object.
NumberOfInstances(byte[] Value, int Count)
Number of instances