From 412430ec76635380c5b0ea4ddd07eb6679de0f86 Mon Sep 17 00:00:00 2001
From: Li
Date: Sat, 7 May 2022 13:30:51 +1200
Subject: [PATCH] Move mod loading to server entry point
---
HorseIsleServer/LibHISP/Server/Entry.cs | 11 +++++++----
HorseIsleServer/LibHISP/Server/GameServer.cs | 2 --
HorseIsleServer/N00BS/Program.cs | 4 ++++
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/HorseIsleServer/LibHISP/Server/Entry.cs b/HorseIsleServer/LibHISP/Server/Entry.cs
index 97bc997..3e51553 100644
--- a/HorseIsleServer/LibHISP/Server/Entry.cs
+++ b/HorseIsleServer/LibHISP/Server/Entry.cs
@@ -7,7 +7,8 @@ using HISP.Game.Chat;
using HISP.Security;
using System;
using System.Diagnostics;
-
+using HISP.Modding;
+
namespace HISP.Server
{
public static class Entry
@@ -27,10 +28,12 @@ namespace HISP.Server
}
public static void Start()
- {
- #if (!DEBUG)
+ {
+#if (!DEBUG)
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
- #endif
+#endif
+
+ ModLoader.ReloadModsFromFilesystem();
Console.Title = ServerVersion.GetBuildString();
ConfigReader.OpenConfig();
diff --git a/HorseIsleServer/LibHISP/Server/GameServer.cs b/HorseIsleServer/LibHISP/Server/GameServer.cs
index 614a61d..15a2f07 100644
--- a/HorseIsleServer/LibHISP/Server/GameServer.cs
+++ b/HorseIsleServer/LibHISP/Server/GameServer.cs
@@ -8277,8 +8277,6 @@ namespace HISP.Server
minuteTimer = new Timer(new TimerCallback(onMinuteTick), null, oneMinute, oneMinute);
Logger.InfoPrint("Binding to ip: " + ConfigReader.BindIP + " On port: " + ConfigReader.Port.ToString());
- // Load all/any mods
- ModLoader.ReloadModsFromFilesystem();
SocketAsyncEventArgs e = new SocketAsyncEventArgs();
e.Completed += GameClient.CreateClient;
diff --git a/HorseIsleServer/N00BS/Program.cs b/HorseIsleServer/N00BS/Program.cs
index 4bc6096..16728a8 100644
--- a/HorseIsleServer/N00BS/Program.cs
+++ b/HorseIsleServer/N00BS/Program.cs
@@ -7,6 +7,7 @@ using HISP.Game.Horse;
using HISP.Game.Items;
using HISP.Game.Services;
using HISP.Game.SwfModules;
+using HISP.Modding;
using HISP.Security;
using HISP.Server;
using HTTP;
@@ -74,6 +75,8 @@ namespace HISP.Noobs
BaseDir = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "HISP", "N00BS");
Directory.CreateDirectory(BaseDir);
+ ModLoader.ReloadModsFromFilesystem();
+
// Start Web Server
try
{
@@ -110,6 +113,7 @@ namespace HISP.Noobs
ConfigReader.CrossDomainPolicyFile = Path.Combine(BaseDir, "CrossDomainPolicy.xml");
ConfigReader.DatabaseName = Path.Combine(BaseDir, "game1.db");
+
IncrementProgress();
Database.OpenDatabase();
IncrementProgress();