Exemplo n.º 1
0
 public static void ClosePorts()
 {
     try
     {
         logger.Trace("ClosePorts()");
         //logger.Trace($"CanTimeout={Code.port.CanTimeout};");
         //Code.port.DiscardInBuffer();
         //Code.port.DiscardOutBuffer();
         Ex.CatchAsync(port.Close).RunParallel();
         Ex.CatchAsync(genr.Close).RunParallel();
         //stats();
     }
     catch (UnauthorizedAccessException ex)
     {
         ex.Log("\n(Порт " + port.PortName +
                " не доступен.)\nUnauthorizedAccessException\nClosePort()");
     }
     catch (Exception ex)
     {
         ex.Log("\n(Порт " + port.PortName + " не доступен.)\nClosePort()");
     }
 }