Cleaned up code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Discord.WebSocket;
|
||||
using PluginManager.Others;
|
||||
|
||||
@@ -41,4 +42,4 @@ internal class Command
|
||||
/// The prefix that is used for the command
|
||||
/// </summary>
|
||||
public char PrefixUsed { get; }
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class ConsoleCommandsHandler
|
||||
{
|
||||
this.client = client;
|
||||
InitializeBasicCommands();
|
||||
Console.WriteLine("Initalized console command handeler !");
|
||||
Console.WriteLine("Initialized console command handler !");
|
||||
}
|
||||
|
||||
private void InitializeBasicCommands()
|
||||
@@ -55,7 +55,7 @@ public class ConsoleCommandsHandler
|
||||
AddCommand("lp", "Load plugins", () =>
|
||||
{
|
||||
if (pluginsLoaded) return;
|
||||
var loader = new PluginLoader(client);
|
||||
var loader = new PluginLoader(client!);
|
||||
loader.onCMDLoad += (name, typeName, success, exception) =>
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
@@ -237,7 +237,7 @@ public class ConsoleCommandsHandler
|
||||
data.Add(new[] { "-", "-" });
|
||||
data.Add(new[] { "Key", "Value" });
|
||||
data.Add(new[] { "-", "-" });
|
||||
foreach (var kvp in d) data.Add(new[] { kvp.Key, kvp.Value.ToString() });
|
||||
foreach (var kvp in d) data.Add(new string[] { kvp.Key, kvp.Value.ToString()! });
|
||||
data.Add(new[] { "-", "-" });
|
||||
Console_Utilities.FormatAndAlignTable(data);
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using PluginManager.Others.Exceptions;
|
||||
|
||||
namespace PluginManager.Items;
|
||||
|
||||
public class Spinner
|
||||
{
|
||||
/// <summary>
|
||||
/// True if active, false otherwise
|
||||
/// </summary>
|
||||
public bool isSpinning;
|
||||
|
||||
/// <summary>
|
||||
/// The Spinner constructor
|
||||
/// </summary>
|
||||
public Spinner()
|
||||
{
|
||||
isSpinning = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method that is called to start spinning the spinner
|
||||
/// </summary>
|
||||
public async void Start()
|
||||
{
|
||||
isSpinning = true;
|
||||
var cnt = 0;
|
||||
|
||||
while (isSpinning)
|
||||
{
|
||||
cnt++;
|
||||
switch (cnt % 4)
|
||||
{
|
||||
case 0:
|
||||
Console.Write("/");
|
||||
break;
|
||||
case 1:
|
||||
Console.Write("-");
|
||||
break;
|
||||
case 2:
|
||||
Console.Write("\\");
|
||||
break;
|
||||
case 3:
|
||||
Console.Write("|");
|
||||
break;
|
||||
}
|
||||
|
||||
Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop);
|
||||
await Task.Delay(250);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method that is called to stop the spinner from spinning
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (!isSpinning) throw new APIException("Spinner was not spinning", GetType());
|
||||
isSpinning = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user