Example #1
0
 /// <summary>
 /// Attempts device unregistration, passing feedback to the console and error log if it fails.
 /// </summary>
 /// <param name="dev">The device to unregister.</param>
 /// <param name="deviceDescriptor">A description of the device for use if it fails and an error is printed.</param>
 /// <returns>Returns true if the unregistration succeeds, false if it fails for any reason.</returns>
 public static bool UnRegister(this GenericBase dev, string deviceDescriptor)
 {
     if (dev == null)
     {
         CrestronConsole.PrintLine("Couldn't unregister {0}, the device was null.", deviceDescriptor);
         ErrorLog.Error("Coudln't unreigster {0}, the device was null.", deviceDescriptor);
         return(false);
     }
     if (dev.UnRegister() != eDeviceRegistrationUnRegistrationResponse.Success)
     {
         CrestronConsole.PrintLine("Couldn't unregister {0} for the reason: {1}", deviceDescriptor, dev.RegistrationFailureReason);
         ErrorLog.Error("Couldn't unregister {0} for the reason: {1}", deviceDescriptor, dev.RegistrationFailureReason);
         return(false);
     }
     CrestronConsole.PrintLine("Unregistered: {0}", deviceDescriptor);
     return(true);
 }