Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Asn1FieldDefinition.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading.Tasks;
6
8{
13 {
14 private readonly string fieldName;
15 private readonly Asn1Type type;
16 private int? tag;
17
24 public Asn1FieldDefinition(string FieldName, int? Tag, Asn1Type Type)
25 : base()
26 {
27 this.fieldName = FieldName;
28 this.type = Type;
29 this.tag = Tag;
30 }
31
35 public string Name => this.fieldName;
36
40 public Asn1Type Type => this.type;
41
45 public int? Tag
46 {
47 get => this.tag;
48 internal set => this.tag = value;
49 }
50
58 public override async Task ExportCSharp(StringBuilder Output, CSharpExportState State,
59 int Indent, CSharpExportPass Pass)
60 {
61 if (Pass == CSharpExportPass.Explicit)
62 {
63 Output.Append(Tabs(Indent));
64 Output.Append("public ");
65 await this.type.ExportCSharp(Output, State, Indent, Pass);
66 Output.Append(' ');
67 Output.Append(ToCSharp(this.fieldName));
68
69 if (!(this.type.Default is null))
70 {
71 Output.Append(" = ");
72 await this.type.Default.ExportCSharp(Output, State, Indent, Pass);
73 }
74
75 Output.AppendLine(";");
76 }
77 else
78 await this.type.ExportCSharp(Output, State, Indent, Pass);
79 }
80 }
81}
Represents an ASN.1 field definition.
override async Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Asn1FieldDefinition(string FieldName, int? Tag, Asn1Type Type)
Represents an ASN.1 field definition.
Base class for all ASN.1 nodes.
Definition: Asn1Node.cs:38
Abstract base class for ASN.1 types.
Definition: Asn1Type.cs:13
CSharpExportPass
Defines different C# export passes.
Definition: Asn1Node.cs:12