From 81d965a718bb293e94e4141a098c560b7f494b3b Mon Sep 17 00:00:00 2001 From: RaidMax Date: Tue, 13 Mar 2018 19:12:24 -0500 Subject: [PATCH] prevent exiting immediately on error. updated mvc packages --- WebfrontCore/Application/Main.cs | 10 +++++----- WebfrontCore/Application/Manager.cs | 3 +++ WebfrontCore/Application/Server.cs | 4 ++-- .../PublishProfiles/FolderProfile.pubxml | 2 +- WebfrontCore/WebfrontCore.csproj | 18 +++++++++--------- WebfrontCore/appsettings.json | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/WebfrontCore/Application/Main.cs b/WebfrontCore/Application/Main.cs index df44b89d2..37e254aa9 100644 --- a/WebfrontCore/Application/Main.cs +++ b/WebfrontCore/Application/Main.cs @@ -31,16 +31,11 @@ namespace IW4MAdmin try { - /*var v1 = SharedLibrary.Helpers.Vector3.Parse("(737, 1117, 268)"); var v2 = SharedLibrary.Helpers.Vector3.Parse("(1510, 672.98, -228.66)"); double angleBetween = v1.AngleBetween(v2);*/ - - CheckDirectories(); - - ServerManager = ApplicationManager.GetInstance(); SharedLibrary.Database.Repair.Run(ServerManager.Logger); ServerManager.Init().Wait(); @@ -76,6 +71,11 @@ namespace IW4MAdmin catch (Exception e) { Console.WriteLine($"Fatal Error during initialization: {e.Message}"); + while(e.InnerException != null) + { + e = e.InnerException; + Console.WriteLine($"Inner exception: {e.Message}"); + } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); return; diff --git a/WebfrontCore/Application/Manager.cs b/WebfrontCore/Application/Manager.cs index c4cecbb50..48e41bb77 100644 --- a/WebfrontCore/Application/Manager.cs +++ b/WebfrontCore/Application/Manager.cs @@ -134,6 +134,9 @@ namespace IW4MAdmin Logger.WriteDebug(e.Message); Logger.WriteDebug($"Internal Exception: {e.Data["internal_exception"]}"); } + + // throw the exception to the main method to stop before instantly exiting + throw e; } } diff --git a/WebfrontCore/Application/Server.cs b/WebfrontCore/Application/Server.cs index c31e82765..25c12baa7 100644 --- a/WebfrontCore/Application/Server.cs +++ b/WebfrontCore/Application/Server.cs @@ -620,8 +620,8 @@ namespace IW4MAdmin string mainPath = (GameName == Game.IW4 && onelog.Value >=0) ? "userraw" : "main"; string logPath = (game.Value == "" || onelog?.Value == 1) ? - $"{ basepath.Value.Replace("\\", "/")}/{mainPath}/{logfile.Value}" : - $"{basepath.Value.Replace("\\", "/")}/{game.Value}/{logfile.Value}"; + $"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{mainPath}{Path.DirectorySeparatorChar}{logfile.Value}" : + $"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{game.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{logfile.Value}"; if (!File.Exists(logPath)) { diff --git a/WebfrontCore/Properties/PublishProfiles/FolderProfile.pubxml b/WebfrontCore/Properties/PublishProfiles/FolderProfile.pubxml index 282b04b61..d2c89acc7 100644 --- a/WebfrontCore/Properties/PublishProfiles/FolderProfile.pubxml +++ b/WebfrontCore/Properties/PublishProfiles/FolderProfile.pubxml @@ -14,7 +14,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt False 65340d7d-5831-406c-acad-b13ba634bde2 C:\Projects\IW4M-Admin\Publish - True + False net452 win7-x86 diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index 831006c98..b278416e2 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -30,19 +30,19 @@ - - - - - - + + + + + + - + - - + + diff --git a/WebfrontCore/appsettings.json b/WebfrontCore/appsettings.json index 138ffa654..c9faf19b7 100644 --- a/WebfrontCore/appsettings.json +++ b/WebfrontCore/appsettings.json @@ -8,7 +8,7 @@ } }, "Web": { - "Address": "127.0.0.1:5000" + "Address": "http://127.0.0.1:5000" }, "VPN": { "APIKey": ""