From 1a2fd004d014f641d5a5f0bd26a23e27864bf36f Mon Sep 17 00:00:00 2001 From: nelinory <15143882+nelinory@users.noreply.github.com> Date: Sat, 9 Nov 2024 09:39:22 -0600 Subject: [PATCH 1/3] Improving device detection #32 --- Services/MediaDeviceService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Services/MediaDeviceService.cs b/Services/MediaDeviceService.cs index 863130b..409e620 100644 --- a/Services/MediaDeviceService.cs +++ b/Services/MediaDeviceService.cs @@ -4,6 +4,7 @@ using SupernoteDesktopClient.Models; using SupernoteDesktopClient.Services.Contracts; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; namespace SupernoteDesktopClient.Services @@ -11,6 +12,8 @@ namespace SupernoteDesktopClient.Services public class MediaDeviceService : IMediaDeviceService { private const string SUPERNOTE_DEVICE_ID = "VID_2207&PID_0011"; + private const string SUPERNOTE_DESCRIPTION = "supernote"; + private const string NOMAD_DESCRIPTION = "nomad"; private MediaDriveInfo _driveInfo; @@ -39,7 +42,14 @@ public MediaDeviceService() public void RefreshMediaDeviceInfo() { - MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.DeviceId.Contains(SUPERNOTE_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); + //MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.DeviceId.Contains(SUPERNOTE_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); + MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.Description.Contains(SUPERNOTE_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase) + || p.Description.Contains(NOMAD_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); + +#if DEBUG + if (tmpDevice != null) + Debug.WriteLine($"Usb Device: {tmpDevice?.DeviceId ?? "N/A"}, Description: {tmpDevice?.Description ?? "N/A"}"); +#endif if (_supernoteManager == null) _supernoteManager = tmpDevice; @@ -106,7 +116,10 @@ public void RefreshMediaDeviceInfo() } } - DiagnosticLogger.Log($"Device: {(_supernoteManager == null ? "N/A" : _supernoteManager)}, DriveInfo: {(_driveInfo == null ? "N/A" : _driveInfo)}"); + DiagnosticLogger.Log($"Usb Device: {_supernoteManager?.DeviceId ?? "N/A"}, " + + $"Description: {_supernoteManager?.Description ?? "N/A"}, " + + $"Model: {_supernoteManager?.Model ?? "N/A"}, " + + $"DriveInfo: {_driveInfo?.TotalSize.GetDataSizeAsString() ?? "N/A"}"); } } } From ef1dd80710786de36a9e538af0771f0bf19d3285 Mon Sep 17 00:00:00 2001 From: nelinory <15143882+nelinory@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:20:58 -0600 Subject: [PATCH 2/3] Cleaned up Supernote Nomad support --- README.md | 6 +++--- Services/MediaDeviceService.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c127af2..4e1987a 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ Supernote Desktop Client (SDC) is a desktop client for Supernote paper-like tabl > SDC is a windows application build with .NET 6. ### Key Features -- Automatically detects Supernote device connected with an USB cable +- Automatically detects Supernote device connected with an USB cable (A5X/A6X/Nomad) - Shows basic information for connected Supernote device - Automatic sync: USB-C / Manual sync: USB-C / Manual sync: WIFI - Supernote storage backup to a local folder - Automatically archives last backup, supports archives retention policy - Supports multiple Supernote devices, each device have an unique local backup folder - Build-in offline mode, which allows most of the application features to be used without having Supernote device connected -- Build-in explorer allows to view and open all Supernote files in the local backup folder (A5X/A6X: support provided by [SupernoteSharp](https://github.com/nelinory/SupernoteSharp) library) +- Build-in explorer allows to view and open all Supernote files in the local backup folder (A5X/A6X/Nomad: support provided by [SupernoteSharp](https://github.com/nelinory/SupernoteSharp) library) - *.note files are converted to vectorized PDF (internal/web links supported) - *.mark files are converted to vectorized PDF (internal/web links supported) - Automatic/Manual check for new application version @@ -30,7 +30,7 @@ Get the latest portable version from [Releases page](https://github.com/nelinory Extract the zip file to a desired location. Run `SupernoteDesktopClient.exe` from inside sdc folder. > If you get a [SmartScreen](https://user-images.githubusercontent.com/25006819/115977864-555d4300-a5ae-11eb-948b-c0139f606a2d.png) popup, click on "More info" and then "Run anyway". -> The reason this popup appears is because the application is portable and it is not signed for distribution through Microsoft store.. +> The reason this popup appears is because the application is portable and it is not signed for distribution through Microsoft store. ### Wiki - [Frequently asked questions](https://github.com/nelinory/SupernoteDesktopClient/wiki/FAQ) diff --git a/Services/MediaDeviceService.cs b/Services/MediaDeviceService.cs index 409e620..d44c055 100644 --- a/Services/MediaDeviceService.cs +++ b/Services/MediaDeviceService.cs @@ -12,6 +12,7 @@ namespace SupernoteDesktopClient.Services public class MediaDeviceService : IMediaDeviceService { private const string SUPERNOTE_DEVICE_ID = "VID_2207&PID_0011"; + private const string NOMAD_DEVICE_ID = "VID_2207&PID_0007"; private const string SUPERNOTE_DESCRIPTION = "supernote"; private const string NOMAD_DESCRIPTION = "nomad"; @@ -42,8 +43,9 @@ public MediaDeviceService() public void RefreshMediaDeviceInfo() { - //MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.DeviceId.Contains(SUPERNOTE_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); - MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.Description.Contains(SUPERNOTE_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase) + MediaDevice tmpDevice = MediaDevice.GetDevices().Where(p => p.DeviceId.Contains(SUPERNOTE_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase) + || p.DeviceId.Contains(NOMAD_DEVICE_ID, System.StringComparison.InvariantCultureIgnoreCase) + || p.Description.Contains(SUPERNOTE_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase) || p.Description.Contains(NOMAD_DESCRIPTION, System.StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); #if DEBUG From 2bea10f731c8469c6bcb65f60406aaade7d93c7c Mon Sep 17 00:00:00 2001 From: nelinory <15143882+nelinory@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:30:20 -0600 Subject: [PATCH 3/3] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e1987a..3846201 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ For release milestones, please check the project board: https://github.com/users ### How to build - Clone SDC repository -- Open SupernoteDesktopClient solution in Visual Studio 2022 and build it +- Open SupernoteDesktopClient solution in [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/community) and build it ### Screenshots ##### Dashboard