示例#1
0
 /// <summary>
 /// Decodes the content of the object by PER.
 /// </summary>
 /// <param name="buffer">A buffer that contains a PER encoding result.</param>
 /// <param name="aligned">Indicating whether the PER decoding is aligned.</param>
 /// <remarks>Length is included.</remarks>
 protected override void ValuePerDecode(IAsn1DecodingBuffer buffer, bool aligned = true)
 {
     Elements = Asn1StandardProcedure.PerDecodeArray(buffer, decodingBuffer =>
     {
         T curObj = new T();
         curObj.PerDecode(buffer);
         return(curObj);
     },
                                                     Constraint != null && Constraint.HasMinSize ? Constraint.MinSize : (long?)null, Constraint != null && Constraint.HasMaxSize ? Constraint.MaxSize : (long?)null);
 }
示例#2
0
 /// <summary>
 /// Decodes the object by PER.
 /// </summary>
 /// <param name="buffer">A buffer that contains a PER encoding result.</param>
 /// <param name="aligned">Indicating whether the PER decoding is aligned.</param>
 /// <remarks>Length is included.</remarks>
 protected override void ValuePerDecode(IAsn1DecodingBuffer buffer, bool aligned = true)
 {
     char[] result = Asn1StandardProcedure.PerDecodeArray <char>(buffer,
                                                                 decodingBuffer =>
     {
         byte[] encodingResult = buffer.ReadBytes(2);
         string s = Encoding.BigEndianUnicode.GetString(encodingResult);
         return(s[0]);
     },
                                                                 Constraint != null && Constraint.HasMinSize ? Constraint.MinSize : (long?)null, Constraint != null && Constraint.HasMaxSize ? Constraint.MaxSize : (long?)null,
                                                                 true);
     Value = new string(result);
 }
 /// <summary>
 /// Decodes the content of the object by PER.
 /// </summary>
 /// <param name="buffer">A buffer that contains a PER encoding result.</param>
 /// <param name="aligned">Indicating whether the PER decoding is aligned.</param>
 /// <remarks>Length is included.</remarks>
 protected override void ValuePerDecode(IAsn1DecodingBuffer buffer, bool aligned = true)
 {
     byte[] res = Asn1StandardProcedure.PerDecodeArray(buffer, decodingBuffer => (decodingBuffer.ReadByte()));
     Value = DecodeIdentifiers(res);
 }