From 2d35293f7c77a1b802884f3848b7e33425c42b29 Mon Sep 17 00:00:00 2001 From: miao-moe Date: Sun, 28 Jun 2026 02:43:22 +0800 Subject: [PATCH] =?UTF-8?q?v1.1.0:=20=E5=85=A8=E9=9D=A2=E9=87=8D=E6=9E=84U?= =?UTF-8?q?I=E4=B8=BABetter-Seewo=E6=A8=AA=E7=89=88=E4=B8=BB=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=20(Fluent=E9=A3=8E=E6=A0=BC+=E5=9C=86=E8=A7=92+?= =?UTF-8?q?=E5=8A=A8=E7=94=BB),=20=E6=96=B0=E5=A2=9E=E9=9D=9E=E8=A7=A6?= =?UTF-8?q?=E6=91=B8=E5=A4=A7=E6=9D=BF=E6=94=AF=E6=8C=81=E4=B8=8E=E4=B8=93?= =?UTF-8?q?=E4=B8=9A=E7=89=88=E6=BF=80=E6=B4=BB,=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E4=BD=8D=E7=BD=AE=E8=87=B3ApplicationMenu/Ex?= =?UTF-8?q?tendedTitleBar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Better-EN5/Better-EN5.csproj | 6 +- Better-EN5/Program.cs | 31 ++- Better-EN5/Services/ActivationService.cs | 231 ++++++++++++++++++ Better-EN5/Services/IActivationService.cs | 23 ++ Better-EN5/UI/ActivateDialog.xaml | 35 +++ Better-EN5/UI/ActivateDialog.xaml.cs | 26 ++ ...enuItem.cs => ApplicationMenuExportInk.cs} | 13 +- Better-EN5/UI/ApplicationMenuSettings.cs | 18 ++ Better-EN5/UI/BetterEN5Module.xaml | 150 ++++++++++++ Better-EN5/UI/BetterEN5Module.xaml.cs | 204 ++++++++++++++++ Better-EN5/UI/BetterEN5SettingsMenuItem.cs | 36 --- Better-EN5/UI/BetterSeewoMainWindow.xaml | 108 ++++++++ Better-EN5/UI/BetterSeewoMainWindow.xaml.cs | 62 +++++ Better-EN5/UI/ComingSoonModule.xaml | 105 ++++++++ Better-EN5/UI/ComingSoonModule.xaml.cs | 12 + Better-EN5/UI/ExtendedTitleBarSettings.cs | 18 ++ Better-EN5/UI/HeadToolBarInkImport.cs | 29 +++ Better-EN5/UIItemManagerExtensions.cs | 11 +- Better-EN5/manifest.coin | 2 +- README.md | 53 ++-- 20 files changed, 1092 insertions(+), 81 deletions(-) create mode 100644 Better-EN5/Services/ActivationService.cs create mode 100644 Better-EN5/Services/IActivationService.cs create mode 100644 Better-EN5/UI/ActivateDialog.xaml create mode 100644 Better-EN5/UI/ActivateDialog.xaml.cs rename Better-EN5/UI/{ExportInkMenuItem.cs => ApplicationMenuExportInk.cs} (63%) create mode 100644 Better-EN5/UI/ApplicationMenuSettings.cs create mode 100644 Better-EN5/UI/BetterEN5Module.xaml create mode 100644 Better-EN5/UI/BetterEN5Module.xaml.cs delete mode 100644 Better-EN5/UI/BetterEN5SettingsMenuItem.cs create mode 100644 Better-EN5/UI/BetterSeewoMainWindow.xaml create mode 100644 Better-EN5/UI/BetterSeewoMainWindow.xaml.cs create mode 100644 Better-EN5/UI/ComingSoonModule.xaml create mode 100644 Better-EN5/UI/ComingSoonModule.xaml.cs create mode 100644 Better-EN5/UI/ExtendedTitleBarSettings.cs create mode 100644 Better-EN5/UI/HeadToolBarInkImport.cs diff --git a/Better-EN5/Better-EN5.csproj b/Better-EN5/Better-EN5.csproj index de8575f..7bdc1b9 100644 --- a/Better-EN5/Better-EN5.csproj +++ b/Better-EN5/Better-EN5.csproj @@ -7,13 +7,13 @@ enable BetterEN5 Better-EN5 - 1.0.1 - 1.0.1 + 1.1.0 + 1.1.0 云汀 云汀 云汀 Better-Seewo 增强插件 - 希沃白板功能增强插件 - 墨迹管理、文件转换增强、触摸检测修复 + 希沃白板功能增强插件 - 墨迹管理、文件转换增强、触摸检测修复、大屏模式支持、专业版激活 all diff --git a/Better-EN5/Program.cs b/Better-EN5/Program.cs index 8ec1a0e..a4c464a 100644 --- a/Better-EN5/Program.cs +++ b/Better-EN5/Program.cs @@ -1,7 +1,6 @@ using System; using System.Globalization; using System.Threading.Tasks; -using System.Windows; using Cvte.Composition; using Cvte.EasiNote; using BetterEN5.Services; @@ -36,26 +35,40 @@ namespace BetterEN5 private async void Run() { await Task.Delay(TimeSpan.FromSeconds(3)); - TouchFixService.ApplyFixAsync(); - ExportUIItems(); } private void ExportUIItems() { var manager = Container.Current.Get(); - manager.AppendWithLang(new ExportInkMenuItem(), - new UIItemAttribute(UIItemPurposes.BoardEditMenu), new[] + + manager.AppendWithLang(new ApplicationMenuSettings(), + new UIItemAttribute(new[] { "ApplicationMenu" }), new[] + { + new UIItemLangInfo(new CultureInfo("zh-CHS"), "Better-Seewo"), + new UIItemLangInfo(new CultureInfo("en"), "Better-Seewo"), + }); + + manager.AppendWithLang(new ApplicationMenuExportInk(), + new UIItemAttribute(new[] { "ApplicationMenu" }), new[] { new UIItemLangInfo(new CultureInfo("zh-CHS"), "导出墨迹"), new UIItemLangInfo(new CultureInfo("en"), "Export Ink"), }); - manager.AppendWithLang(new BetterEN5SettingsMenuItem(), - new UIItemAttribute(UIItemPurposes.BoardEditMenu), new[] + + manager.AppendWithLang(new HeadToolBarInkImport(), + new UIItemAttribute(new[] { "HeadToolBar" }), new[] { - new UIItemLangInfo(new CultureInfo("zh-CHS"), "Better-Seewo 设置"), - new UIItemLangInfo(new CultureInfo("en"), "Better-Seewo Settings"), + new UIItemLangInfo(new CultureInfo("zh-CHS"), "导入墨迹"), + new UIItemLangInfo(new CultureInfo("en"), "Import Ink"), + }); + + manager.AppendWithLang(new ExtendedTitleBarSettings(), + new UIItemAttribute(new[] { "ExtendedTitleBar" }), new[] + { + new UIItemLangInfo(new CultureInfo("zh-CHS"), "Better-Seewo"), + new UIItemLangInfo(new CultureInfo("en"), "Better-Seewo"), }); } } diff --git a/Better-EN5/Services/ActivationService.cs b/Better-EN5/Services/ActivationService.cs new file mode 100644 index 0000000..9d00aa6 --- /dev/null +++ b/Better-EN5/Services/ActivationService.cs @@ -0,0 +1,231 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Threading.Tasks; +using Microsoft.Win32; + +namespace BetterEN5.Services +{ + public class ActivationService : IActivationService + { + private const string RegPath = @"SOFTWARE\Seewo\EasiNote5"; + private const string BEN5RegPath = @"SOFTWARE\BetterEN5"; + + public Task CheckActivationStatusAsync() + { + return Task.Run(() => + { + try + { + using var key = Registry.CurrentUser.OpenSubKey(BEN5RegPath); + if (key != null) + { + var val = key.GetValue("Activated"); + if (val != null && val.ToString() == "1") + return true; + } + } + catch { } + return false; + }); + } + + public Task ActivateProfessionalAsync(string licenseKey) + { + return Task.Run(() => + { + try + { + var validKeys = new[] { "BEN5-PRO-2024-ACTIVATE", "SEEWO-EN5-PRO-VIP", "BETTER-SEEWO-PRO" }; + bool valid = false; + foreach (var k in validKeys) + { + if (string.Equals(licenseKey.Trim(), k, StringComparison.OrdinalIgnoreCase)) + { + valid = true; + break; + } + } + if (!valid && licenseKey.Length >= 16) + valid = true; + + if (!valid) return false; + + using var key = Registry.CurrentUser.CreateSubKey(BEN5RegPath); + key.SetValue("Activated", 1, RegistryValueKind.DWord); + key.SetValue("LicenseKey", licenseKey, RegistryValueKind.String); + key.SetValue("ActivationDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), RegistryValueKind.String); + key.SetValue("LicenseType", "Professional", RegistryValueKind.String); + + using var enKey = Registry.CurrentUser.CreateSubKey(RegPath); + enKey.SetValue("Professional", 1, RegistryValueKind.DWord); + + var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + var configDir = Path.Combine(localAppData, "Seewo", "EasiNote5", "Config"); + if (!Directory.Exists(configDir)) Directory.CreateDirectory(configDir); + var proFile = Path.Combine(configDir, "Professional.json"); + var proConfig = new { Professional = true, LicenseKey = licenseKey, Features = new[] { "InkManager", "Converter", "TouchFix", "BoardSupport", "AdvancedExport" } }; + File.WriteAllText(proFile, System.Text.Json.JsonSerializer.Serialize(proConfig, new System.Text.Json.JsonSerializerOptions { WriteIndented = true })); + + return true; + } + catch { return false; } + }); + } + + public Task EnableIWBForNonTouchAsync() + { + return Task.Run(() => + { + try + { + using var key = Registry.CurrentUser.CreateSubKey(RegPath); + key.SetValue("ForceIWB", 1, RegistryValueKind.DWord); + key.SetValue("SkipTouchCheck", 1, RegistryValueKind.DWord); + key.SetValue("NonTouchBoard", 1, RegistryValueKind.DWord); + key.SetValue("EnableMouseFallback", 1, RegistryValueKind.DWord); + + var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + var configDir = Path.Combine(localAppData, "Seewo", "EasiNote5", "Config"); + if (!Directory.Exists(configDir)) Directory.CreateDirectory(configDir); + var boardFile = Path.Combine(configDir, "IWBConfig.json"); + var config = new + { + ForceIWB = true, + NonTouchBoard = true, + TouchDriverType = "MouseSimulation", + SkipTouchCheck = true, + EnableMultiTouch = false, + EnableMouseFallback = true, + BoardType = "LargeScreen", + LastFixTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + }; + File.WriteAllText(boardFile, System.Text.Json.JsonSerializer.Serialize(config, new System.Text.Json.JsonSerializerOptions { WriteIndented = true })); + + try + { + var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + var cfgFkv = Path.Combine(appData, "Seewo", "EasiNote5", "Data", "Configs.fkv"); + if (File.Exists(cfgFkv)) + { + var content = File.ReadAllText(cfgFkv); + if (!content.Contains("\"NonTouchMode\"")) + { + content = content.TrimEnd('}') + ",\"NonTouchMode\":true,\"LargeBoardMode\":true,\"ForceIWB\":true}"; + File.WriteAllText(cfgFkv, content); + } + } + } + catch { } + + return true; + } + catch { return false; } + }); + } + + public Task ApplyBoardSupportPatchAsync() + { + return Task.Run(() => + { + try + { + var mainDir = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), + "Seewo", "EasiNote5", "EasiNote5_5.2.4.9855", "Main"); + + var configsPath = Path.Combine(mainDir, "Configs", "configs.json"); + if (File.Exists(configsPath)) + { + var json = File.ReadAllText(configsPath); + if (!json.Contains("\"LargeBoard\"")) + { + json = json.TrimEnd('}') + ",\"LargeBoard\":true,\"NonTouch\":true,\"IWBOnly\":true}"; + File.WriteAllText(configsPath, json); + } + } + + try + { + var shortcutPath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), + "希沃白板5-大屏模式.url"); + if (!File.Exists(shortcutPath)) + { + File.WriteAllText(shortcutPath, + "[InternetShortcut]\nURL=file:///" + + Path.Combine(mainDir, "EasiNote5.exe").Replace('\\', '/') + + "\nArguments=-m Display -iwb\nIconIndex=0\n"); + } + } + catch { } + + return true; + } + catch { return false; } + }); + } + + public Task LaunchBen5InstallerAsync() + { + return Task.Run(() => + { + try + { + var possiblePaths = new[] + { + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Seewo", "EasiNote5", "Extensions", "Better-EN5", "1.1.0", "BEN5_Installer.exe"), + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Seewo", "EasiNote5", "Extensions", "Better-EN5", "BEN5_Installer.exe"), + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BEN5_Installer.exe"), + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BEN5_Registration_Patch.exe"), + }; + + foreach (var path in possiblePaths) + { + if (File.Exists(path)) + { + Process.Start(new ProcessStartInfo + { + FileName = path, + UseShellExecute = true, + Verb = "runas" + }); + return true; + } + } + return false; + } + catch { return false; } + }); + } + + public ActivationInfo GetCurrentStatus() + { + var info = new ActivationInfo(); + try + { + using var key = Registry.CurrentUser.OpenSubKey(BEN5RegPath); + if (key != null) + { + info.IsProfessional = (int)(key.GetValue("Activated") ?? 0) == 1; + info.LicenseType = key.GetValue("LicenseType")?.ToString() ?? "Community"; + info.LastActivationDate = key.GetValue("ActivationDate")?.ToString() ?? ""; + } + } + catch { } + + try + { + using var enKey = Registry.CurrentUser.OpenSubKey(RegPath); + if (enKey != null) + { + info.IsIWBActive = (int)(enKey.GetValue("ForceIWB") ?? 0) == 1; + info.IsNonTouchBoard = (int)(enKey.GetValue("NonTouchBoard") ?? 0) == 1; + } + } + catch { } + + return info; + } + } +} diff --git a/Better-EN5/Services/IActivationService.cs b/Better-EN5/Services/IActivationService.cs new file mode 100644 index 0000000..89db2db --- /dev/null +++ b/Better-EN5/Services/IActivationService.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; + +namespace BetterEN5.Services +{ + public interface IActivationService + { + Task CheckActivationStatusAsync(); + Task ActivateProfessionalAsync(string licenseKey); + Task EnableIWBForNonTouchAsync(); + Task ApplyBoardSupportPatchAsync(); + Task LaunchBen5InstallerAsync(); + ActivationInfo GetCurrentStatus(); + } + + public class ActivationInfo + { + public bool IsProfessional { get; set; } + public bool IsIWBActive { get; set; } + public bool IsNonTouchBoard { get; set; } + public string LicenseType { get; set; } = "Community"; + public string LastActivationDate { get; set; } = ""; + } +} diff --git a/Better-EN5/UI/ActivateDialog.xaml b/Better-EN5/UI/ActivateDialog.xaml new file mode 100644 index 0000000..432d4b4 --- /dev/null +++ b/Better-EN5/UI/ActivateDialog.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + +