11using System ;
2- using System . Globalization ;
3- using SysadminsLV . Asn1Parser . Utils ;
42
53namespace SysadminsLV . Asn1Parser . Universal ;
64
@@ -14,7 +12,7 @@ public sealed class Asn1UtcTime : Asn1DateTime {
1412 /// Initializes a new instance of the <strong>Asn1UtcTime</strong> class from a date time object
1513 /// to encode and value that indicates whether to include millisecond information.
1614 /// </summary>
17- /// <param name="time">A <see cref="DateTime"/> object.</param>
15+ /// <param name="time">A <see cref="DateTime"/> object in local time zone .</param>
1816 /// <param name="preciseTime">
1917 /// <strong>True</strong> if encoded value should contain millisecond information, otherwise <strong>False</strong>.
2018 /// </param>
@@ -23,14 +21,15 @@ public Asn1UtcTime(DateTime time, Boolean preciseTime) : this(time, null, precis
2321 /// Initializes a new instance of the <strong>Asn1UtcTime</strong> class from a date time object
2422 /// to encode, time zone information and value that indicates whether to include millisecond information.
2523 /// </summary>
26- /// <param name="time">A <see cref="DateTime"/> object.</param>
24+ /// <param name="time">
25+ /// A <see cref="DateTime"/> object in destination time zone if zone information is provided.
26+ /// Local time zone is assumed if zone information is not provided (null).
27+ /// </param>
2728 /// <param name="zone">A <see cref="TimeZoneInfo"/> object that represents time zone information.</param>
2829 /// <param name="preciseTime">
2930 /// <strong>True</strong> if encoded value should contain millisecond information, otherwise <strong>False</strong>.
3031 /// </param>
31- public Asn1UtcTime ( DateTime time , TimeZoneInfo zone = null , Boolean preciseTime = false ) : base ( TYPE ) {
32- m_encode ( time , zone , preciseTime ) ;
33- }
32+ public Asn1UtcTime ( DateTime time , TimeZoneInfo ? zone = null , Boolean preciseTime = false ) : base ( TYPE , time , zone , preciseTime ) { }
3433 /// <summary>
3534 /// Initializes a new instance of the <strong>Asn1UtcTime</strong> class from an existing
3635 /// <see cref="Asn1Reader"/> object.
@@ -39,9 +38,7 @@ public Asn1UtcTime(DateTime time, TimeZoneInfo zone = null, Boolean preciseTime
3938 /// <exception cref="Asn1InvalidTagException">
4039 /// The current state of <strong>ASN1</strong> object is not UTC time.
4140 /// </exception>
42- public Asn1UtcTime ( Asn1Reader asn ) : base ( asn , TYPE ) {
43- m_decode ( asn . GetTagRawData ( ) ) ;
44- }
41+ public Asn1UtcTime ( Asn1Reader asn ) : base ( asn , TYPE ) { }
4542 /// <summary>
4643 /// Initializes a new instance of the <strong>Asn1UtcTime</strong> class from a byte array that
4744 /// represents encoded UTC time.
@@ -50,27 +47,5 @@ public Asn1UtcTime(Asn1Reader asn) : base(asn, TYPE) {
5047 /// <exception cref="Asn1InvalidTagException">
5148 /// The current state of <strong>ASN1</strong> object is not UTC time.
5249 /// </exception>
53- public Asn1UtcTime ( Byte [ ] rawData ) : base ( new Asn1Reader ( rawData ) , TYPE ) {
54- m_decode ( rawData ) ;
55- }
56-
57- void m_encode ( DateTime time , TimeZoneInfo zone , Boolean preciseTime ) {
58- Value = time ;
59- ZoneInfo = zone ;
60- Initialize ( new Asn1Reader ( Asn1Utils . Encode ( DateTimeUtils . Encode ( time , zone , true , preciseTime ) , TYPE ) ) ) ;
61- }
62- void m_decode ( Byte [ ] rawData ) {
63- var asn = new Asn1Reader ( rawData ) ;
64- Initialize ( asn ) ;
65- Value = DateTimeUtils . Decode ( asn , out TimeZoneInfo zoneInfo ) ;
66- ZoneInfo = zoneInfo ;
67- }
68-
69- /// <summary>
70- /// Gets decoded date/time string value.
71- /// </summary>
72- /// <returns>Decoded date/time string value.</returns>
73- public override String GetDisplayValue ( ) {
74- return Value . ToString ( CultureInfo . InvariantCulture ) ;
75- }
50+ public Asn1UtcTime ( Byte [ ] rawData ) : base ( new Asn1Reader ( rawData ) , TYPE ) { }
7651}
0 commit comments