This commit is contained in:
@@ -1,4 +1,11 @@
|
|||||||
using DiscordBot.Discord.Core;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using DiscordBot.Discord.Core;
|
||||||
|
|
||||||
using PluginManager;
|
using PluginManager;
|
||||||
using PluginManager.Items;
|
using PluginManager.Items;
|
||||||
@@ -6,13 +13,6 @@ using PluginManager.Online;
|
|||||||
using PluginManager.Online.Helpers;
|
using PluginManager.Online.Helpers;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Terminal.Gui;
|
using Terminal.Gui;
|
||||||
|
|
||||||
using OperatingSystem = PluginManager.Others.OperatingSystem;
|
using OperatingSystem = PluginManager.Others.OperatingSystem;
|
||||||
@@ -55,7 +55,9 @@ public class Program
|
|||||||
|
|
||||||
var labelInfo =
|
var labelInfo =
|
||||||
new Label(
|
new Label(
|
||||||
"Configuration file not found or invalid. Please fill the following fields to create a new configuration file.")
|
"Configuration file not found or invalid. " +
|
||||||
|
"Please fill the following fields to create a new configuration file."
|
||||||
|
)
|
||||||
{
|
{
|
||||||
X = Pos.Center(),
|
X = Pos.Center(),
|
||||||
Y = 2
|
Y = 2
|
||||||
@@ -174,8 +176,7 @@ public class Program
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main loop for the discord bot
|
/// The main loop for the discord bot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="discordbooter">The discord booter used to start the application</param>
|
private static void NoGUI()
|
||||||
private static void NoGUI(Boot discordbooter)
|
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
@@ -203,7 +204,7 @@ public class Program
|
|||||||
/// Start the bot without user interface
|
/// Start the bot without user interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns the boot loader for the Discord Bot</returns>
|
/// <returns>Returns the boot loader for the Discord Bot</returns>
|
||||||
private static async Task<Boot> StartNoGUI()
|
private static async Task<Boot> StartNoGui()
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||||
@@ -257,23 +258,6 @@ public class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clear folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="d">Directory path</param>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle user input arguments from the startup of the application
|
/// Handle user input arguments from the startup of the application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -282,7 +266,7 @@ public class Program
|
|||||||
{
|
{
|
||||||
var len = args.Length;
|
var len = args.Length;
|
||||||
|
|
||||||
var b = await StartNoGUI();
|
var b = await StartNoGui();
|
||||||
consoleCommandsHandler = new ConsoleCommandsHandler(b.client);
|
consoleCommandsHandler = new ConsoleCommandsHandler(b.client);
|
||||||
|
|
||||||
if (len > 0 && args[0] == "/remplug")
|
if (len > 0 && args[0] == "/remplug")
|
||||||
@@ -293,11 +277,14 @@ public class Program
|
|||||||
loadPluginsOnStartup = true;
|
loadPluginsOnStartup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (len > 0 && args[0] == "/lp")
|
||||||
|
loadPluginsOnStartup = true;
|
||||||
|
|
||||||
var mainThread = new Thread(() =>
|
var mainThread = new Thread(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NoGUI(b);
|
NoGUI();
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
@@ -402,8 +389,11 @@ public class Program
|
|||||||
break;
|
break;
|
||||||
case "UpdaterVersion":
|
case "UpdaterVersion":
|
||||||
var updaternewversion = s[1];
|
var updaternewversion = s[1];
|
||||||
if ((Config.UpdaterVersion != updaternewversion &&
|
if (Functions.GetOperatingSystem() == OperatingSystem.LINUX)
|
||||||
Functions.GetOperatingSystem() == OperatingSystem.WINDOWS) || !Directory.Exists("./Updater") ||
|
break;
|
||||||
|
|
||||||
|
if (Config.UpdaterVersion != updaternewversion ||
|
||||||
|
!Directory.Exists("./Updater") ||
|
||||||
!File.Exists("./Updater/Updater.exe"))
|
!File.Exists("./Updater/Updater.exe"))
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user