This commit is contained in:
2023-02-12 12:25:53 +02:00
parent 5b01b15216
commit 0d5c90323a
4 changed files with 11 additions and 18 deletions

View File

@@ -11,7 +11,6 @@ namespace DiscordBot
public class Entry public class Entry
{ {
internal static StartupArguments startupArguments; internal static StartupArguments startupArguments;
[STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
AppDomain currentDomain = AppDomain.CurrentDomain; AppDomain currentDomain = AppDomain.CurrentDomain;
@@ -26,16 +25,7 @@ namespace DiscordBot
return assembly; return assembly;
} }
Task.Run(async () => { Program.Startup(args);
if (!File.Exists(Functions.dataFolder + "loader.json"))
{
startupArguments = new StartupArguments();
await Functions.SaveToJsonFile(Functions.dataFolder + "loader.json", startupArguments);
}
else
startupArguments = await Functions.ConvertFromJson<StartupArguments>(Functions.dataFolder + "loader.json");
}).Wait();
Program.Startup(args.Concat(startupArguments.runArgs.Split(' ')).ToArray());
} }
} }

View File

@@ -178,6 +178,15 @@ public class Program
Directory.CreateDirectory("./Data/Plugins"); Directory.CreateDirectory("./Data/Plugins");
Directory.CreateDirectory("./Data/PAKS"); Directory.CreateDirectory("./Data/PAKS");
if (!File.Exists(Functions.dataFolder + "loader.json"))
{
Entry.startupArguments = new StartupArguments();
await Functions.SaveToJsonFile(Functions.dataFolder + "loader.json", Entry.startupArguments);
}
else
Entry.startupArguments = await Functions.ConvertFromJson<StartupArguments>(Functions.dataFolder + "loader.json");
Settings.sqlDatabase = new SqlDatabase("SetDB.dat"); Settings.sqlDatabase = new SqlDatabase("SetDB.dat");
await Settings.sqlDatabase.Open(); await Settings.sqlDatabase.Open();

View File

@@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic;
using PluginManager.Online.Helpers; using PluginManager.Online.Helpers;
using PluginManager.Others; using PluginManager.Others;

View File

@@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "..\DiscordBotItems
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBEconomy", "..\DiscordBotItems\Plugins\DBEconomy\DBEconomy.csproj", "{0321365B-4ADC-4B1D-BD98-F573D36E83B2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBEconomy", "..\DiscordBotItems\Plugins\DBEconomy\DBEconomy.csproj", "{0321365B-4ADC-4B1D-BD98-F573D36E83B2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "..\DiscordBotItems\Updater\Updater.csproj", "{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -53,10 +51,6 @@ Global
{0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.Build.0 = Release|Any CPU {0321365B-4ADC-4B1D-BD98-F573D36E83B2}.Release|Any CPU.Build.0 = Release|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A411BE0-6AE4-4129-A0BD-0D1D5D4E2D1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE