1
+ using System ;
2
+ using System . IO ;
3
+ using System . Text ;
4
+
5
+ namespace SysadminsLV . Asn1Parser . Universal ;
6
+ /// <summary>
7
+ /// Represents an ASN.1 <strong>VideotexString</strong> data type.
8
+ /// The ASN.1 VideotexString type supports T.100/T.101 characters. This type is no longer used.
9
+ /// </summary>
10
+ public sealed class Asn1VideotexString : Asn1String {
11
+ const Asn1Type TYPE = Asn1Type . VideotexString ;
12
+
13
+ /// <summary>
14
+ /// Initializes a new instance of the <strong>Asn1VideotexString</strong> class from an <see cref="Asn1Reader"/>
15
+ /// object.
16
+ /// </summary>
17
+ /// <param name="asn">Existing <see cref="Asn1Reader"/> object.</param>
18
+ /// <exception cref="Asn1InvalidTagException">
19
+ /// Current position in the <strong>ASN.1</strong> object is not <strong>VideotexString</strong> data type.
20
+ /// </exception>
21
+ /// <exception cref="InvalidDataException">
22
+ /// Input data contains invalid VideotexString character.
23
+ /// </exception>
24
+ public Asn1VideotexString ( Asn1Reader asn ) : base ( asn , TYPE ) {
25
+ decode ( asn ) ;
26
+ }
27
+ /// <summary>
28
+ /// Initializes a new instance of <strong>Asn1VideotexString</strong> from a ASN.1-encoded byte array.
29
+ /// </summary>
30
+ /// <param name="rawData">ASN.1-encoded byte array.</param>
31
+ /// <exception cref="Asn1InvalidTagException">
32
+ /// <strong>rawData</strong> is not <strong>VideotexString</strong> data type.
33
+ /// </exception>
34
+ /// <exception cref="InvalidDataException">
35
+ /// Input data contains invalid VideotexString character.
36
+ /// </exception>
37
+ public Asn1VideotexString ( Byte [ ] rawData ) : this ( new Asn1Reader ( rawData ) ) { }
38
+ /// <summary>
39
+ /// Initializes a new instance of the <strong>Asn1VideotexString</strong> class from a unicode string.
40
+ /// </summary>
41
+ /// <param name="inputString">A unicode string to encode.</param>
42
+ /// <exception cref="InvalidDataException">
43
+ /// <strong>inputString</strong> contains invalid VideotexString characters
44
+ /// </exception>
45
+ public Asn1VideotexString ( String inputString ) : base ( TYPE ) {
46
+ encode ( inputString ) ;
47
+ }
48
+
49
+ void encode ( String inputString ) {
50
+ Initialize ( new Asn1Reader ( Asn1Utils . Encode ( Encoding . ASCII . GetBytes ( inputString ) , TYPE ) ) ) ;
51
+ Value = inputString ;
52
+ }
53
+ void decode ( Asn1Reader asn ) {
54
+ Value = Encoding . ASCII . GetString ( asn . GetPayload ( ) ) ;
55
+ }
56
+
57
+ /// <inheritdoc/>
58
+ public override String GetDisplayValue ( ) {
59
+ return Value ;
60
+ }
61
+ }
0 commit comments