Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Asn1Sequence.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading.Tasks;
5
7{
11 public class Asn1Sequence : Asn1List
12 {
19 public Asn1Sequence(string Name, bool TypeDef, Asn1Node[] Nodes)
20 : base(Name, TypeDef, Nodes)
21 {
22 }
23
27 public override bool ConstructedType => true;
28
36 public override async Task ExportCSharp(StringBuilder Output, CSharpExportState State,
37 int Indent, CSharpExportPass Pass)
38 {
39 if (Pass == CSharpExportPass.Implicit)
40 {
41 State.ClosePending(Output);
42
43 foreach (Asn1Node Node in this.Nodes)
44 await Node.ExportCSharp(Output, State, Indent, Pass);
45
46 Output.Append(Tabs(Indent));
47 Output.Append("public class ");
48 Output.Append(ToCSharp(this.Name));
49 if (!this.TypeDefinition)
50 Output.AppendLine("Seq");
51
52 Output.Append(Tabs(Indent));
53 Output.AppendLine("{");
54
55 Indent++;
56
57 foreach (Asn1Node Node in this.Nodes)
58 await Node.ExportCSharp(Output, State, Indent, CSharpExportPass.Explicit);
59
60 Indent--;
61
62 Output.AppendLine();
63 Output.Append(Tabs(Indent));
64 Output.AppendLine("}");
65 Output.AppendLine();
66 }
67 else if (Pass == CSharpExportPass.Explicit)
68 {
69 if (this.TypeDefinition)
70 {
71 State.ClosePending(Output);
72
73 Output.Append(Tabs(Indent));
74 Output.Append("public class ");
75 Output.AppendLine(ToCSharp(this.Name));
76
77 Output.Append(Tabs(Indent));
78 Output.AppendLine("{");
79
80 Indent++;
81
82 foreach (Asn1Node Node in this.Nodes)
83 await Node.ExportCSharp(Output, State, Indent, CSharpExportPass.Implicit);
84
85 foreach (Asn1Node Node in this.Nodes)
86 await Node.ExportCSharp(Output, State, Indent, CSharpExportPass.Explicit);
87
88 Indent--;
89
90 Output.Append(Tabs(Indent));
91 Output.AppendLine("}");
92 Output.AppendLine();
93 }
94 else
95 {
96 Output.Append(ToCSharp(this.Name));
97 Output.Append("Seq");
98 }
99 }
100 }
101
102 }
103}
void ClosePending(StringBuilder Output)
Close pending actions
string Name
Optional field or type name.
bool TypeDefinition
If construct is part of a type definition.
Abstract base class for list constructs.
Definition: Asn1List.cs:11
Base class for all ASN.1 nodes.
Definition: Asn1Node.cs:38
virtual Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Definition: Asn1Node.cs:46
Represents a ASN.1 SEQUENCE construct.
Definition: Asn1Sequence.cs:12
override async Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Definition: Asn1Sequence.cs:36
Asn1Sequence(string Name, bool TypeDef, Asn1Node[] Nodes)
Represents a ASN.1 SEQUENCE construct.
Definition: Asn1Sequence.cs:19
override bool ConstructedType
If the type is a constructed type.
Definition: Asn1Sequence.cs:27
CSharpExportPass
Defines different C# export passes.
Definition: Asn1Node.cs:12