Updated display when installing a new plugin
This commit is contained in:
@@ -129,15 +129,21 @@ public class Plugin : ICommandAction
|
|||||||
if (string.IsNullOrEmpty(pluginName) || pluginName.Length < 2)
|
if (string.IsNullOrEmpty(pluginName) || pluginName.Length < 2)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Please specify a plugin name");
|
Console.WriteLine("Please specify a plugin name");
|
||||||
|
Console.Write("Plugin name : ");
|
||||||
|
pluginName = Console.ReadLine();
|
||||||
|
if (string.IsNullOrEmpty(pluginName) || pluginName.Length < 2)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Invalid plugin name");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var pluginManager =
|
var pluginManager =
|
||||||
new PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
new PluginsManager(Program.URLs["PluginList"], Program.URLs["PluginVersions"]);
|
||||||
var pluginData = await pluginManager.GetPluginLinkByName(pluginName);
|
var pluginData = await pluginManager.GetPluginLinkByName(pluginName);
|
||||||
if (pluginData == null || pluginData.Length == 0)
|
if (pluginData == null || pluginData.Length == 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Plugin not found");
|
Console.WriteLine($"Plugin {pluginName} not found. Please check the spelling and try again.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +156,8 @@ public class Plugin : ICommandAction
|
|||||||
//download plugin progress bar for linux and windows terminals
|
//download plugin progress bar for linux and windows terminals
|
||||||
var spinner = new Utilities.Utilities.Spinner();
|
var spinner = new Utilities.Utilities.Spinner();
|
||||||
spinner.Start();
|
spinner.Start();
|
||||||
await ServerCom.DownloadFileAsync(pluginLink, $"./Data/{pluginType}s/{pluginName}.dll", null);
|
IProgress<float> progress = new Progress<float>(p => { spinner.Message = $"Downloading {pluginName}... {Math.Round(p,2)}% " ; });
|
||||||
|
await ServerCom.DownloadFileAsync(pluginLink, $"./Data/{pluginType}s/{pluginName}.dll", progress);
|
||||||
spinner.Stop();
|
spinner.Stop();
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ public static class Utilities
|
|||||||
private bool isRunning;
|
private bool isRunning;
|
||||||
private int position;
|
private int position;
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
|
public string Message;
|
||||||
|
|
||||||
public Spinner()
|
public Spinner()
|
||||||
{
|
{
|
||||||
@@ -220,7 +221,8 @@ public static class Utilities
|
|||||||
{
|
{
|
||||||
while (isRunning)
|
while (isRunning)
|
||||||
{
|
{
|
||||||
Console.Write("\r" + Sequence[position]);
|
Console.SetCursorPosition(0, Console.CursorTop);
|
||||||
|
Console.Write(" " + Sequence[position] + " " + Message + " ");
|
||||||
position++;
|
position++;
|
||||||
if (position >= Sequence.Length)
|
if (position >= Sequence.Length)
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class PluginsManager
|
|||||||
for (var i = 0; i < len; i++)
|
for (var i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
var contents = lines[i].Split(',');
|
var contents = lines[i].Split(',');
|
||||||
if (contents[0] == name)
|
if (contents[0].ToLowerInvariant() == name.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
if (contents.Length == 6)
|
if (contents.Length == 6)
|
||||||
return new[] { contents[2], contents[3], contents[5] };
|
return new[] { contents[2], contents[3], contents[5] };
|
||||||
|
|||||||
Reference in New Issue
Block a user