Esempio n. 1
0
 /// <summary>
 /// Copy values from another Pdu class.
 /// </summary>
 /// <param name="value"><see cref="Pdu"/> cast as AsnType</param>
 /// <exception cref="ArgumentNullException">Thrown when received argument is null</exception>
 public void Set(AsnType value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (value is Pdu pdu)
     {
         Type             = pdu.Type;
         _requestId.Value = pdu.RequestId;
         if (Type == PduType.GetBulk)
         {
             NonRepeaters   = pdu.NonRepeaters;
             MaxRepetitions = pdu.MaxRepetitions;
         }
         else
         {
             ErrorStatus = pdu.ErrorStatus;
             ErrorIndex  = pdu.ErrorIndex;
         }
         _vbs.Clear();
         foreach (Vb v in pdu.VbList)
         {
             _vbs.Add((Vb)v.Clone());
         }
     }
     else
     {
         throw new ArgumentNullException("value", "Argument is not an Oid class");
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Set VbList
 /// </summary>
 /// <remarks>
 /// Copy variable bindings from argument <see cref="VbCollection"/> into this classes variable
 /// binding collection
 /// </remarks>
 /// <param name="value"><see cref="VbCollection"/> to copy variable bindings from</param>
 public void SetVbList(VbCollection value)
 {
     _vbs.Clear();
     foreach (Vb v in value)
     {
         _vbs.Add(v);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Duplicate Vbs object
        /// </summary>
        /// <returns>Duplicate of the Vbs object</returns>
        public override Object Clone()
        {
            VbCollection vb = new VbCollection();

            foreach (Vb v in this)
            {
                vb.Add(v);
            }
            return(vb);
        }