From 3f7a8e04d4f8987c3f561eb5d80b2d591cc7655c Mon Sep 17 00:00:00 2001 From: Wizzy69 Date: Fri, 14 Oct 2022 11:06:56 +0300 Subject: [PATCH 1/2] --- DiscordBot/Program.cs | 17 ----------------- PluginManager/Interfaces/DBEvent.cs | 4 ++-- PluginManager/Items/ConsoleCommandsHandler.cs | 4 +++- PluginManager/Loaders/PluginLoader.cs | 2 +- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs index 03b973e..a813d7a 100644 --- a/DiscordBot/Program.cs +++ b/DiscordBot/Program.cs @@ -257,23 +257,6 @@ public class Program } } - /// - /// Clear folder - /// - /// Directory path - private static Task ClearFolder(string d) - { - var files = Directory.GetFiles(d); - var fileNumb = files.Length; - for (var i = 0; i < fileNumb; i++) - { - File.Delete(files[i]); - Console.WriteLine("Deleting : " + files[i]); - } - - return Task.CompletedTask; - } - /// /// Handle user input arguments from the startup of the application /// diff --git a/PluginManager/Interfaces/DBEvent.cs b/PluginManager/Interfaces/DBEvent.cs index 0ab89ab..5458636 100644 --- a/PluginManager/Interfaces/DBEvent.cs +++ b/PluginManager/Interfaces/DBEvent.cs @@ -7,12 +7,12 @@ public interface DBEvent /// /// The name of the event /// - string name { get; } + string Name { get; } /// /// The description of the event /// - string description { get; } + string Description { get; } /// /// The method that is invoked when the event is loaded into memory diff --git a/PluginManager/Items/ConsoleCommandsHandler.cs b/PluginManager/Items/ConsoleCommandsHandler.cs index 9ba8807..21aacb3 100644 --- a/PluginManager/Items/ConsoleCommandsHandler.cs +++ b/PluginManager/Items/ConsoleCommandsHandler.cs @@ -98,7 +98,9 @@ public class ConsoleCommandsHandler else { Console.ForegroundColor = ConsoleColor.Red; - + if (exception is null) + Console.WriteLine("An error occured while loading: " + name); + else Console.WriteLine("[CMD] Failed to load command : " + name + " because " + exception!.Message); } diff --git a/PluginManager/Loaders/PluginLoader.cs b/PluginManager/Loaders/PluginLoader.cs index a292f4a..d12c632 100644 --- a/PluginManager/Loaders/PluginLoader.cs +++ b/PluginManager/Loaders/PluginLoader.cs @@ -131,7 +131,7 @@ public class PluginLoader if (e.IsLoaded) ((DBEvent)e.Plugin!).Start(_client); - onEVELoad?.Invoke(((DBEvent)e.Plugin!).name, e.TypeName!, e.IsLoaded, e.Exception); + onEVELoad?.Invoke(((DBEvent)e.Plugin!).Name, e.TypeName!, e.IsLoaded, e.Exception); } catch (Exception ex) { From 403c02319172a7dfb693c1ff4ab9b5e2b5334534 Mon Sep 17 00:00:00 2001 From: Wizzy69 Date: Fri, 14 Oct 2022 11:13:09 +0300 Subject: [PATCH 2/2] --- DiscordBot/Program.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs index a813d7a..241cd12 100644 --- a/DiscordBot/Program.cs +++ b/DiscordBot/Program.cs @@ -385,10 +385,12 @@ public class Program break; case "UpdaterVersion": var updaternewversion = s[1]; - if ((Config.UpdaterVersion != updaternewversion && - Functions.GetOperatingSystem() == OperatingSystem.WINDOWS) || !Directory.Exists("./Updater") || + if (Config.UpdaterVersion != updaternewversion || !Directory.Exists("./Updater") || !File.Exists("./Updater/Updater.exe")) { + + if (Functions.GetOperatingSystem() != OperatingSystem.WINDOWS) + break; Console.Clear(); Console.WriteLine("Installing updater ...\nDo NOT close the bot during update !"); var bar = new Console_Utilities.ProgressBar(ProgressBarType.NO_END);