private int ReRegisterPort()
 {
     if (_Versiport.Registered)
     {
         if (_Versiport.UnRegister() != eDeviceRegistrationUnRegistrationResponse.Success)
         {
             ErrorLog.Error("Error Unregistering IOPort ID {0}: {1}", _Versiport.ID, _Versiport.DeviceRegistrationFailureReason);
             return(-1);
         }
     }
     if (_Versiport.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
     {
         ErrorLog.Error("Error Registering IOPort ID {0}: {1}", _Versiport.ID, _Versiport.DeviceRegistrationFailureReason);
         return(-1);
     }
     _Configuration = _Versiport.VersiportConfiguration;
     return(0);
 }
 protected virtual void Terminate()
 {
     try
     {
         //if (ControlCEC != null)
         //ControlCEC = null;
         if (ControlIR != null)
         {
             ControlIR.UnRegister();
         }
         if (ControlRelay != null)
         {
             ControlRelay.UnRegister();
         }
         if (ControlSerial != null)
         {
             ControlSerial.UnRegister();
         }
         if (ControlTCP != null)
         {
             ControlTCP.Dispose();
         }
         if (ControlUDP != null)
         {
             ControlUDP.Dispose();
         }
         if (ControlVP != null)
         {
             ControlVP.UnRegister();
         }
     }
     catch (Exception e)
     {
         ErrorLog.Exception("Exception terminating " + this.Name, e);
     }
 }