Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Asn1Node.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading.Tasks;
5
7{
11 public enum CSharpExportPass
12 {
16 Preprocess,
17
21 Variables,
22
26 Implicit,
27
31 Explicit
32 }
33
37 public abstract class Asn1Node
38 {
46 public virtual Task ExportCSharp(StringBuilder Output, CSharpExportState State,
47 int Indent, CSharpExportPass Pass)
48 {
49 if (Pass == CSharpExportPass.Explicit)
50 {
51 throw new NotImplementedException("Support for exporting objects of type " +
52 this.GetType().FullName + " not implemented.");
53 }
54
55 return Task.CompletedTask;
56 }
57
58 internal static string Tabs(int Indent)
59 {
60 return new string('\t', Indent);
61 }
62
63 internal static string ToCSharp(string Identifier)
64 {
65 switch (Identifier)
66 {
67 case "abstract":
68 case "as":
69 case "base":
70 case "bool":
71 case "break":
72 case "byte":
73 case "case":
74 case "catch":
75 case "char":
76 case "checked":
77 case "class":
78 case "const":
79 case "continue":
80 case "decimal":
81 case "default":
82 case "delegate":
83 case "do":
84 case "double":
85 case "else":
86 case "enum":
87 case "event":
88 case "explicit":
89 case "extern":
90 case "false":
91 case "finally":
92 case "fixed":
93 case "float":
94 case "for":
95 case "foreach":
96 case "goto":
97 case "if":
98 case "implicit":
99 case "in":
100 case "int":
101 case "interface":
102 case "internal":
103 case "is":
104 case "lock":
105 case "long":
106 case "namespace":
107 case "new":
108 case "null":
109 case "object":
110 case "operator":
111 case "out":
112 case "override":
113 case "params":
114 case "private":
115 case "protected":
116 case "public":
117 case "readonly":
118 case "ref":
119 case "return":
120 case "sbyte":
121 case "sealed":
122 case "short":
123 case "sizeof":
124 case "stackalloc":
125 case "static":
126 case "string":
127 case "struct":
128 case "switch":
129 case "this":
130 case "throw":
131 case "true":
132 case "try":
133 case "typeof":
134 case "uint":
135 case "ulong":
136 case "unchecked":
137 case "unsafe":
138 case "ushort":
139 case "using":
140 case "virtual":
141 case "void":
142 case "add":
143 case "alias":
144 case "ascending":
145 case "async":
146 case "await":
147 case "by":
148 case "descending":
149 case "dynamic":
150 case "equals":
151 case "from":
152 case "get":
153 case "global":
154 case "group":
155 case "into":
156 case "join":
157 case "let":
158 case "nameof":
159 case "on":
160 case "orderby":
161 case "partial":
162 case "remove":
163 case "select":
164 case "set":
165 case "value":
166 case "var":
167 case "when":
168 case "where":
169 case "yield":
170 return "_" + Identifier;
171
172 default:
173 int i = Identifier.IndexOf('-');
174 if (i >= 0)
175 Identifier = Identifier.Replace('-', '_');
176
177 return Identifier;
178 }
179 }
180 }
181}
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
CSharpExportPass
Defines different C# export passes.
Definition: Asn1Node.cs:12