mirror of
https://github.com/islehorse/HISP.git
synced 2025-05-09 13:04:50 +12:00
Fix N00BS
This commit is contained in:
parent
0c299729dd
commit
b3df338715
15 changed files with 71 additions and 81 deletions
HorseIsleServer/LibHISP
|
@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.7.92.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.92.0")]
|
||||
[assembly: AssemblyVersion("1.7.99.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.99.0")]
|
||||
|
|
|
@ -43,8 +43,12 @@ namespace HISP.Server
|
|||
|
||||
public static void OnShutdown()
|
||||
{
|
||||
MySqlConnection.ClearAllPools();
|
||||
SqliteConnection.ClearAllPools();
|
||||
|
||||
if(!ConfigReader.SqlLite)
|
||||
MySqlConnection.ClearAllPools();
|
||||
else
|
||||
SqliteConnection.ClearAllPools();
|
||||
|
||||
}
|
||||
|
||||
public static bool TryExecuteSqlQuery(string query)
|
||||
|
@ -134,7 +138,6 @@ namespace HISP.Server
|
|||
|
||||
if (ConfigReader.SqlLite)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DbCommand sqlCommand = db.CreateCommand();
|
||||
|
|
|
@ -21,21 +21,24 @@ namespace HISP.Server
|
|||
{
|
||||
Process.GetCurrentProcess().Close();
|
||||
}
|
||||
public static Action OnShutdown = defaultOnShutdownCallback;
|
||||
|
||||
public static Action OnShutdown = defaultOnShutdownCallback;
|
||||
|
||||
public static void SetShutdownCallback(Action callback)
|
||||
{
|
||||
OnShutdown = callback;
|
||||
}
|
||||
|
||||
public static void RegisterCrashHandler()
|
||||
{
|
||||
#if (!DEBUG)
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HispCrashHandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
|
||||
#if (!DEBUG)
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
#endif
|
||||
|
||||
RegisterCrashHandler();
|
||||
Console.Title = ServerVersion.GetBuildString();
|
||||
ConfigReader.OpenConfig();
|
||||
CrossDomainPolicy.GetPolicy();
|
||||
|
@ -61,25 +64,18 @@ namespace HISP.Server
|
|||
GameServer.StartServer();
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
private static void HispCrashHandler(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Exception execpt = (Exception)e.ExceptionObject;
|
||||
|
||||
|
||||
Logger.ErrorPrint("HISP HAS CRASHED :(");
|
||||
Logger.ErrorPrint("Unhandled Exception: " + execpt.ToString());
|
||||
Logger.ErrorPrint(execpt.StackTrace);
|
||||
string crashMsg = "HISP HAS CRASHED :(";
|
||||
crashMsg += "Build: " + ServerVersion.GetBuildString();
|
||||
crashMsg += "Unhandled Exception: " + execpt.Message;
|
||||
crashMsg += execpt.StackTrace;
|
||||
|
||||
try
|
||||
{
|
||||
File.AppendAllText("crashlog.txt", "HISP HAS CRASHED :(\n");
|
||||
File.AppendAllText("crashlog.txt", "Unhandled Exception: " + execpt.ToString() + "\n");
|
||||
File.AppendAllText("crashlog.txt", execpt.StackTrace + "\n");
|
||||
}
|
||||
catch (Exception) { };
|
||||
|
||||
Thread.Sleep(5000);
|
||||
Environment.Exit(1);
|
||||
Logger.CrashPrint(crashMsg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,9 +102,9 @@ namespace HISP.Server
|
|||
client.LoggedinUser.Inventory.AddIgnoringFull(rubyItem);
|
||||
}
|
||||
|
||||
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
|
||||
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
|
||||
Logger.DebugPrint("Kicking: " + client.LoggedinUser.Username);
|
||||
}
|
||||
|
||||
client.Kick("Server shutdown.");
|
||||
|
||||
}
|
||||
|
|
|
@ -8258,18 +8258,16 @@ namespace HISP.Server
|
|||
}
|
||||
public static void ShutdownServer()
|
||||
{
|
||||
Logger.InfoPrint("Shutting down.");
|
||||
Logger.InfoPrint("Server shutting down.");
|
||||
try
|
||||
{
|
||||
GameClient.OnShutdown();
|
||||
GameServer.OnShutdown();
|
||||
Database.OnShutdown();
|
||||
Entry.OnShutdown();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Environment.Exit(1);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
Entry.OnShutdown();
|
||||
}
|
||||
|
||||
public static void StartServer()
|
||||
|
|
|
@ -41,6 +41,10 @@ namespace HISP.Server
|
|||
{
|
||||
if (ConfigReader.LogLevel >= 5)
|
||||
logFunction(false, "DEBUG", text);
|
||||
}
|
||||
public static void CrashPrint(string text)
|
||||
{
|
||||
logFunction(true, "CRASH", text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue