Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Asn1SyntaxException.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4
6{
11 {
12 private readonly string text;
13 private readonly int pos;
14
21 public Asn1SyntaxException(string Message, string Text, int Position)
22 : base(Format(Message, Text, Position))
23 {
24 this.text = Text;
25 this.pos = Position;
26 }
27
31 public string Text => this.text;
32
36 public int Position => this.pos;
37
38 private static string Format(string Message, string Text, int Position)
39 {
40 int Pos = Position - 100;
41 int End = Pos + 200;
42 int NewPos = 100;
43
44 if (Pos < 0)
45 {
46 NewPos += Pos;
47 Pos = 0;
48 }
49
50 if (End > Text.Length)
51 End = Text.Length;
52
53 string s = Text.Substring(Pos, End - Pos);
54 s = s.Insert(NewPos, "^^^-------- " + Message + " -----");
55
56 return Message + "\r\n\r\n" + s;
57 }
58 }
59}
Base class from ASN.1 exceptions.
int Position
Position into text where exception was raised.
Asn1SyntaxException(string Message, string Text, int Position)
ASN.1 syntax exceptions.