|
4 | 4 | using SupernoteDesktopClient.Models; |
5 | 5 | using SupernoteDesktopClient.Services.Contracts; |
6 | 6 | using System.Collections.Generic; |
| 7 | +using System.Diagnostics; |
7 | 8 | using System.Linq; |
8 | 9 |
|
9 | 10 | namespace SupernoteDesktopClient.Services |
10 | 11 | { |
11 | 12 | public class MediaDeviceService : IMediaDeviceService |
12 | 13 | { |
13 | 14 | private const string SUPERNOTE_DEVICE_ID = "VID_2207&PID_0011"; |
| 15 | + private const string NOMAD_DEVICE_ID = "VID_2207&PID_0007"; |
| 16 | + private const string SUPERNOTE_DESCRIPTION = "supernote"; |
| 17 | + private const string NOMAD_DESCRIPTION = "nomad"; |
14 | 18 |
|
15 | 19 | private MediaDriveInfo _driveInfo; |
16 | 20 |
|
@@ -39,7 +43,15 @@ public MediaDeviceService() |
39 | 43 |
|
40 | 44 | public void RefreshMediaDeviceInfo() |
41 | 45 | { |
42 | | - MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.DeviceId.Contains(SUPERNOTE_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); |
| 46 | + MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.DeviceId.Contains(SUPERNOTE_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase) |
| 47 | + || p.DeviceId.Contains(NOMAD_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase) |
| 48 | + || p.Description.Contains(SUPERNOTE_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase) |
| 49 | + || p.Description.Contains(NOMAD_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); |
| 50 | + |
| 51 | +#if DEBUG |
| 52 | + if (tmpDevice != null) |
| 53 | + Debug.WriteLine($"Usb Device: {tmpDevice?.DeviceId ?? "N/A"}, Description: {tmpDevice?.Description ?? "N/A"}"); |
| 54 | +#endif |
43 | 55 |
|
44 | 56 | if (_supernoteManager == null) |
45 | 57 | _supernoteManager = tmpDevice; |
@@ -106,7 +118,10 @@ public void RefreshMediaDeviceInfo() |
106 | 118 | } |
107 | 119 | } |
108 | 120 |
|
109 | | - DiagnosticLogger.Log($"Device: {(_supernoteManager == null ? "N/A" : _supernoteManager)}, DriveInfo: {(_driveInfo == null ? "N/A" : _driveInfo)}"); |
| 121 | + DiagnosticLogger.Log($"Usb Device: {_supernoteManager?.DeviceId ?? "N/A"}, " + |
| 122 | + $"Description: {_supernoteManager?.Description ?? "N/A"}, " + |
| 123 | + $"Model: {_supernoteManager?.Model ?? "N/A"}, " + |
| 124 | + $"DriveInfo: {_driveInfo?.TotalSize.GetDataSizeAsString() ?? "N/A"}"); |
110 | 125 | } |
111 | 126 | } |
112 | 127 | } |
0 commit comments