Skip to content

Commit

Permalink
Added already existing plugins handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzTacosOfficial committed Apr 19, 2023
1 parent 701a36d commit d8f5788
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NSMBe5/Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static int LoadPlugin(string pluginPath)
Assembly pluginAsm;
Type pluginClass;
string pluginName;

try
{
pluginAsm = Assembly.LoadFile(pluginPath);
Expand Down
12 changes: 10 additions & 2 deletions NSMBe5/Plugin/PluginSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,17 @@ private void installButton_Click(object sender, EventArgs e)

foreach (string path in dialog.FileNames)
{
string dest = System.IO.Path.Combine(pluginPath, System.IO.Path.GetFileName(path));
string file = System.IO.Path.GetFileName(path);

System.IO.File.Copy(path, dest);
string dest = System.IO.Path.Combine(pluginPath, file);

if (System.IO.File.Exists(dest))
{
MessageBox.Show($"Plugin \"{file}\" already exists", "Plugin Selector", MessageBoxButtons.OK, MessageBoxIcon.Error);
continue;
}

System.IO.File.Copy(path, dest);

PluginManager.LoadPlugin(dest);
}
Expand Down

0 comments on commit d8f5788

Please sign in to comment.