Skip to content

Commit

Permalink
修复部分情况下插件安装失败后无法重新安装的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yqzhishen committed Apr 28, 2022
1 parent 2e9c5f7 commit d5263ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions csharp/Framework/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
4 changes: 2 additions & 2 deletions csharp/GUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]

0 comments on commit d5263ae

Please sign in to comment.