2using System.Collections.Generic;
4using System.Threading.Tasks;
35 private readonly
string identifier;
38 private readonly
bool _abstract;
104 if (!(this.body.Imports is
null))
106 foreach (
Asn1Import Import
in this.body.Imports)
108 if (
string.IsNullOrEmpty(Import.
Module))
122 Output.Append(
"using ");
124 Output.AppendLine(
";");
132 Output.Append(Tabs(Indent));
133 Output.Append(
"namespace ");
136 Output.AppendLine(ToCSharp(this.identifier));
137 Output.Append(Tabs(Indent));
138 Output.AppendLine(
"{");
141 if (!(this.body.Imports is
null))
143 foreach (
Asn1Import Import
in this.body.Imports)
145 if (
string.IsNullOrEmpty(Import.
Module))
151 if (!(Nodes is
null))
159 await TypeDef.ExportCSharp(Output, State, Indent,
CSharpExportPass.Preprocess);
166 await this.body.ExportCSharp(Output, State, Indent,
CSharpExportPass.Preprocess);
169 await this.body.ExportCSharp(Output, State, Indent,
CSharpExportPass.Variables);
172 await this.body.ExportCSharp(Output, State, Indent,
CSharpExportPass.Explicit);
176 Output.Append(Tabs(Indent));
177 Output.AppendLine(
"}");
Represents an ASN.1 document.
string ExportCSharp(CSharpExportSettings Settings)
Exports ASN.1 schemas to C#
Asn1Definitions Root
ASN.1 Root node
void AddCode(string Identifier, string Code, Asn1Document Document)
Adds C# code for a given identifier.
bool ContainsCode(string Identifier)
If C# code is available for a given identifier.
Asn1Document GetDocument(string Identifier)
Gets C# code for a given identifier.
string BaseNamespace
Base Namespace
string Namespace(string Identifier)
Namespace for a given identifier.
CSharpExportSettings Settings
C# export settings.
void ClosePending(StringBuilder Output)
Close pending actions
Represents a collection of ASN.1 definitions.
Asn1Module Body
Definition body.
bool Abstract
If abstract syntax is used.
Asn1Oid Oid
Optional Object ID
Asn1Definitions(string Identifier, Asn1Oid Oid, Asn1Tags? Tags, bool Abstract, Asn1Module Body, Asn1Document Document)
Represents a collection of ASN.1 definitions.
Asn1Document Document
ASN.1 document of which the definition is part.
string Identifier
Identifier
Asn1Tags? Tags
How tags are handled.
override async Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Represents one import instruction.
string[] Identifiers
Identifiers to import.
async Task< Asn1Document > LoadDocument()
Loads the ASN.1 document to import.
string Module
Module reference.
Represents an ASN.1 module.
Base class for all ASN.1 nodes.
Represents an ASN.1 Type definition.
virtual bool ConstructedType
If the type is a constructed type.
Represents an ASN.1 Object ID
Asn1Tags
How ASN.1 tags are managed.
CSharpExportPass
Defines different C# export passes.