Fix global exception handler

This commit is contained in:
SilicaAndPina 2021-05-13 12:42:42 +12:00
parent 9930832730
commit 1c57c3fefd
4 changed files with 38 additions and 37 deletions

View file

@ -109,7 +109,7 @@ namespace HISP.Game.Events
string msgCheck = message.ToLower();
foreach(string answer in Answers)
{
if (answer.ToLower().Contains(msgCheck))
if (msgCheck.ToLower().Contains(answer))
return true;
}
return false;

View file

@ -6,6 +6,8 @@ using HISP.Game.SwfModules;
using HISP.Security;
using HISP.Server;
using HISP.Game.Services;
using System.IO;
namespace HISP
{
public class Program
@ -13,48 +15,45 @@ namespace HISP
static void Main(string[] args)
{
#if (!DEBUG)
try
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#endif
Console.Title = "HISP - Horse Isle Server Emulator";
ConfigReader.OpenConfig();
CrossDomainPolicy.GetPolicy();
Database.OpenDatabase();
GameDataJson.ReadGamedata();
Console.Title = "HISP - Horse Isle Server Emulator";
ConfigReader.OpenConfig();
CrossDomainPolicy.GetPolicy();
Database.OpenDatabase();
GameDataJson.ReadGamedata();
Map.OpenMap();
World.ReadWorldData();
Treasure.Init();
Map.OpenMap();
World.ReadWorldData();
Treasure.Init();
DroppedItems.Init();
WildHorse.Init();
DroppedItems.Init();
WildHorse.Init();
Drawingroom.LoadAllDrawingRooms();
Brickpoet.LoadPoetryRooms();
Multiroom.CreateMultirooms();
Drawingroom.LoadAllDrawingRooms();
Brickpoet.LoadPoetryRooms();
Multiroom.CreateMultirooms();
Auction.LoadAllAuctionRooms();
Auction.LoadAllAuctionRooms();
Item.DoSpecialCases();
Item.DoSpecialCases();
GameServer.StartServer();
#if (!DEBUG)
}
catch(Exception e)
{
Logger.ErrorPrint("Server has crashed! :(");
Logger.ErrorPrint("");
Logger.ErrorPrint("");
Logger.ErrorPrint("UNCAUGHT EXCEPTION!");
Logger.ErrorPrint("");
Logger.ErrorPrint("");
Logger.ErrorPrint(e.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(e.StackTrace);
while(true){};
}
#endif
GameServer.StartServer();
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception execpt = (Exception)e.ExceptionObject;
Logger.ErrorPrint("HISP HAS CRASHED :(");
Logger.ErrorPrint("Unhandled Exception: " + execpt.ToString());
Logger.ErrorPrint(execpt.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(execpt.StackTrace);
while (true) { };
}
}
}

View file

@ -5539,6 +5539,8 @@ namespace HISP.Server
}
}
message = message.Trim();
if (Chat.ProcessCommand(sender.LoggedinUser, message))
{
Logger.DebugPrint(sender.LoggedinUser.Username + " Attempting to run command '" + message + "' in channel: " + channel.ToString());

View file

@ -83,10 +83,10 @@ if(isset($_POST['cbt'], $_POST['user'],$_POST['pass1'],$_POST['pass2'],$_POST['s
if($username == $password)
array_push($problems, "Username and Password can not be the same!");
if(str_contains($username, $password))
if(strpos($username, $password) !== false)
array_push($problems, "The password cannot be within the username!.");
if(str_contains($password, $username))
if(strpos($password, $username) !== false)
array_push($problems, "The password cannot have the username within it!.");