public void Dispose() { _UsbDeviceConnection?.Dispose(); _UsbDevice?.Dispose(); _ReadEndpoint?.Dispose(); _WriteEndpoint?.Dispose(); }
public void Close() { if (_IsClosing) { return; } _IsClosing = true; try { _UsbDeviceConnection?.Dispose(); _UsbDevice?.Dispose(); ReadUsbInterface?.Dispose(); WriteUsbInterface?.Dispose(); _UsbDeviceConnection = null; _UsbDevice = null; ReadUsbInterface = null; WriteUsbInterface = null; } catch (Exception) { //TODO: Logging } _IsClosing = false; }
public void Dispose() { if (NativeDevice != null) { NativeDevice.Dispose(); NativeDevice = null; } if (Connection != null) { Connection.Dispose(); Connection = null; } if (Endpoint != null) { Endpoint.Dispose(); Endpoint = null; } if (EndpointWrite != null) { EndpointWrite.Dispose(); EndpointWrite = null; } if (Manager != null) { Manager.Dispose(); Manager = null; } }
public void Dispose() { if (disposed) { return; } disposed = true; UsbInterface.Dispose(); _UsbDeviceConnection.Dispose(); }
public void Dispose() { if (disposed) { Logger.LogWarning(Messages.WarningMessageAlreadyDisposed, UsbInterface?.ToString()); return; } disposed = true; Logger.LogInformation(Messages.InformationMessageDisposingDevice, UsbInterface?.ToString()); UsbInterface.Dispose(); _UsbDeviceConnection.Dispose(); }
public sealed override void Dispose() { if (disposed) { Logger.LogWarning(Messages.WarningMessageAlreadyDisposed, DeviceNumberId); return; } disposed = true; Logger.LogInformation(Messages.InformationMessageDisposingDevice, DeviceNumberId); Close(); try { _UsbDeviceConnection?.Dispose(); _UsbDevice?.Dispose(); ReadUsbInterface?.Dispose(); WriteUsbInterface?.Dispose(); _UsbDeviceConnection = null; _UsbDevice = null; ReadUsbInterface = null; WriteUsbInterface = null; } catch (Exception ex) { Logger.LogError(ex, "Dispose error DeviceId: {deviceNumberId}", DeviceNumberId); } _InitializingSemaphoreSlim.Dispose(); base.Dispose(); GC.SuppressFinalize(this); }
public void Dispose() { _UsbDeviceConnection?.Dispose(); _UsbDevice?.Dispose(); }