Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Update MainService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Dec 1, 2019
1 parent 09fe03a commit 5f8f27b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions neo-cli/Shell/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,22 +1250,21 @@ private bool OnUnInstallCommand(string[] args)
}

var pluginName = args[1];
var plugin = Plugin.Plugins.Where(u => u.Name.Contains(pluginName)).FirstOrDefault();
if (plugin == null)
var plugin = Plugin.Plugins.FirstOrDefault(p => p.Name == pluginName);
if (plugin is null)
{
Console.WriteLine("Plugin not found");
return true;
}

// Get library name
pluginName = Path.GetFileNameWithoutExtension(plugin.GetType().Assembly.ManifestModule.Name);

if (Directory.Exists(Path.Combine("Plugins", pluginName)))
string path = plugin.GetType().Assembly.Location;
File.Delete(path);
path = Path.ChangeExtension(path, null);
if (Directory.Exists(path))
{
Directory.Delete(Path.Combine("Plugins", pluginName), true);
Directory.Delete(path, true);
}

File.Delete(Path.Combine("Plugins", $"{pluginName}.dll"));
Console.WriteLine($"Uninstall successful, please restart neo-cli.");
return true;
}
Expand Down

0 comments on commit 5f8f27b

Please sign in to comment.