Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Vector.cs
1
using
System
;
2
using
System.Collections
;
3
using
System.Text;
4
5
namespace
NeuroAccess.Nfc.TravelDocuments.Security
6
{
12
public
class
Vector(Array Elements, byte[] SubSection) : IEnumerable
13
{
17
public
Array Elements {
get
; } = Elements;
18
22
public
byte
[] SubSection {
get
; } = SubSection;
23
27
public
int
Length => this.Elements.Length;
28
32
public
object
? FirstElement =>
this
[0];
33
37
public
object
? LastElement =>
this
[this.Length - 1];
38
44
public
object
? FirstElementNested
45
{
46
get
47
{
48
object
? First = this.FirstElement;
49
if
(First is not
byte
[] Binary)
50
return
First;
51
52
if
(ASN1.TryDecodeDer(Binary, out
object
? Decoded))
53
{
54
this.Elements.SetValue(Decoded, 0);
55
return
Decoded;
56
}
57
58
return
First;
59
}
60
}
61
67
public
object
? LastElementNested
68
{
69
get
70
{
71
object
? Last = this.LastElement;
72
73
if
(Last is not
byte
[] Binary)
74
return
Last;
75
76
if
(ASN1.TryDecodeDer(Binary, out
object
? Decoded))
77
{
78
this.Elements.SetValue(Decoded, this.Length - 1);
79
return
Decoded;
80
}
81
82
return
Last;
83
}
84
}
85
91
public
object
?
this
[
int
Index]
92
{
93
get
94
{
95
if
(Index < 0 || Index >= this.Elements.Length)
96
return
null
;
97
else
98
return
this.Elements.GetValue(Index);
99
}
100
}
101
103
public
override
string
ToString
()
104
{
105
StringBuilder sb =
new
();
106
bool
First =
true
;
107
108
sb.Append(this.GetType().Name);
109
sb.Append(
'('
);
110
111
foreach
(
object
? Item
in
this
)
112
{
113
if
(First)
114
First =
false
;
115
else
116
sb.Append(
','
);
117
118
sb.Append(Item?.
ToString
() ??
"null"
);
119
}
120
121
sb.Append(
')'
);
122
123
return
sb.ToString();
124
}
125
130
public
IEnumerator GetEnumerator()
131
{
132
return
this.Elements.GetEnumerator();
133
}
134
}
135
}
NeuroAccess.Nfc.TravelDocuments.Security
Definition:
ContextSpecific.cs:4
System.Collections
Definition:
ImplTypes.g.cs:4970
System
Definition:
Adapters.g.cs:58
Waher.Content.ToString
delegate string ToString(IElement Element)
Delegate for callback methods that convert an element value to a string.
NeuroAccessMaui
NeuroAccess.Nfc
TravelDocuments
Security
Vector.cs
Generated by
1.9.5