From 882d559df3805efda5963dde2342be8776ae5b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=AA=20Trung=20Hi=E1=BA=BFu?= Date: Wed, 8 Jul 2026 08:55:36 +0700 Subject: [PATCH] refactor: remove dead PLGX-related code - Remove PluginPackageFormat.Plgx; only DLL format is supported. - Remove PLGX detection from PluginPathResolver. - Remove PLGX asset URL handling from UpdateChecker. - Remove PLGX tests; dotnet test passes 51/51. - Remove *.plgx from .gitignore. Closes #35. --- .gitignore | 1 - src/PluginPathResolver.cs | 9 +-------- src/UpdateChecker.cs | 3 +-- tests/Tests.cs | 28 ---------------------------- 4 files changed, 2 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 96bfc09..f0e6f54 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ tests/obj/ .worktrees/ *.user *.suo -*.plgx *.dll diff --git a/src/PluginPathResolver.cs b/src/PluginPathResolver.cs index 78da902..b83b457 100644 --- a/src/PluginPathResolver.cs +++ b/src/PluginPathResolver.cs @@ -5,8 +5,7 @@ namespace KeePassAutoReload { internal enum PluginPackageFormat { - Dll, - Plgx + Dll } internal static class PluginPathResolver @@ -36,14 +35,8 @@ public static PluginPackageFormat ResolveInstalledFormat(string keepassExecutabl } string pluginsDir = Path.Combine(keepassExecutableDirectory, "Plugins"); - string plgxPath = Path.Combine(pluginsDir, "KeePassAutoReload.plgx"); string dllPath = Path.Combine(pluginsDir, "KeePassAutoReload.dll"); - if (File.Exists(plgxPath)) - { - return PluginPackageFormat.Plgx; - } - return File.Exists(dllPath) ? PluginPackageFormat.Dll : PluginPackageFormat.Dll; } } diff --git a/src/UpdateChecker.cs b/src/UpdateChecker.cs index 59832b1..ae57842 100644 --- a/src/UpdateChecker.cs +++ b/src/UpdateChecker.cs @@ -171,8 +171,7 @@ private static bool TryParseVersion(string value, out Version version) private static string BuildAssetUrl(string tagName, PluginPackageFormat format) { if (string.IsNullOrEmpty(tagName)) return ReleasesUrl; - string extension = format == PluginPackageFormat.Plgx ? ".plgx" : ".dll"; - return "https://github.com/hieuck/KeePassAutoReload/releases/download/" + tagName + "/KeePassAutoReload" + extension; + return "https://github.com/hieuck/KeePassAutoReload/releases/download/" + tagName + "/KeePassAutoReload.dll"; } private static string BuildReleaseUrl(string tagName) diff --git a/tests/Tests.cs b/tests/Tests.cs index cc400e8..61ba70f 100644 --- a/tests/Tests.cs +++ b/tests/Tests.cs @@ -165,14 +165,6 @@ public async Task ReturnsDllAssetUrlByDefault() Assert.EndsWith("KeePassAutoReload.dll", info.AssetUrl); } - [Fact] - public async Task ReturnsPlgxAssetUrlWhenFormatIsPlgx() - { - FakeUpdateClient client = new FakeUpdateClient { Response = "[{\"tag_name\":\"v1.0.1\"}]" }; - UpdateInfo info = await UpdateChecker.CheckLatestAsync(client, PluginPackageFormat.Plgx); - Assert.EndsWith("KeePassAutoReload.plgx", info.AssetUrl); - } - [Fact] public async Task ThrowsOperationCanceledExceptionWhenAlreadyCanceled() { @@ -302,26 +294,6 @@ public void ThrowsWhenKeePassDirectoryIsNullOrWhitespace(string keepassDirectory Assert.Throws(() => PluginPathResolver.ResolvePluginPackagePath(null, keepassDirectory)); } - [Fact] - public void ResolveInstalledFormat_DetectsPlgxWhenPlgxFileExists() - { - string tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); - try - { - string pluginsDir = Path.Combine(tempDir, "Plugins"); - Directory.CreateDirectory(pluginsDir); - File.WriteAllText(Path.Combine(pluginsDir, "KeePassAutoReload.plgx"), "plgx"); - File.WriteAllText(Path.Combine(pluginsDir, "KeePassAutoReload.dll"), "dll"); - - PluginPackageFormat format = PluginPathResolver.ResolveInstalledFormat(tempDir); - Assert.Equal(PluginPackageFormat.Plgx, format); - } - finally - { - if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); - } - } - [Fact] public void ResolveInstalledFormat_DefaultsToDllWhenOnlyDllExists() {