From d5263aed625af8d50d128853932f637d299b6c97 Mon Sep 17 00:00:00 2001 From: yqzhishen Date: Thu, 28 Apr 2022 19:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E6=8F=92=E4=BB=B6=E5=AE=89=E8=A3=85=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=90=8E=E6=97=A0=E6=B3=95=E9=87=8D=E6=96=B0=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- csharp/Framework/PluginManager.cs | 14 +++++++++----- csharp/GUI/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/csharp/Framework/PluginManager.cs b/csharp/Framework/PluginManager.cs index 0f788f3..e5c78a9 100644 --- a/csharp/Framework/PluginManager.cs +++ b/csharp/Framework/PluginManager.cs @@ -113,21 +113,25 @@ public static Plugin ExtractPlugin(string path, out string folder) public static void InstallPlugin(Plugin plugin, string folder) { var folderName = Path.GetFileName(folder); + var targetFolder = Path.Combine(PluginPath, folderName); if (Plugins.ContainsKey(plugin.Identifier)) // plugin already exists { new DirectoryInfo(Folders[plugin.Identifier]).Delete(true); - Directory.Move(folder, Path.Combine(PluginPath, folderName)); } else // a new plugin { - if (Directory.Exists(Path.Combine(PluginPath, folderName))) + if (Directory.Exists(targetFolder)) { - throw new IOException($"试图安装一个新的插件,但其目录名“{folderName}”与已有插件冲突。请联系插件的发布者。"); + if (Folders.ContainsValue(targetFolder)) + { + throw new IOException($"试图安装一个新的插件,但其目录名“{folderName}”与已有插件冲突。请联系插件的发布者。"); + } + new DirectoryInfo(targetFolder).Delete(true); } - Directory.Move(folder, Path.Combine(PluginPath, folderName)); } + Directory.Move(folder, targetFolder); Plugins[plugin.Identifier] = plugin; - Folders[plugin.Identifier] = folder; + Folders[plugin.Identifier] = targetFolder; } } } diff --git a/csharp/GUI/Properties/AssemblyInfo.cs b/csharp/GUI/Properties/AssemblyInfo.cs index bcdbd7f..17dde5f 100644 --- a/csharp/GUI/Properties/AssemblyInfo.cs +++ b/csharp/GUI/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.1")] -[assembly: AssemblyFileVersion("1.1.0.1")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.1.0")] +[assembly: AssemblyFileVersion("1.1.1.0")] \ No newline at end of file