Unstable 0.17.1.0

This commit is contained in:
Markus Isberg
2022-03-17 01:25:04 +09:00
parent 3974067915
commit 6d410cc1b7
302 changed files with 5878 additions and 3317 deletions
@@ -1,5 +1,6 @@
using System.Diagnostics;
using System.IO.Pipes;
using System.Linq;
namespace Barotrauma.Networking
{
@@ -12,6 +13,9 @@ namespace Barotrauma.Networking
public static void Start(ProcessStartInfo processInfo)
{
CrashString = null;
CrashReportFilePath = null;
writePipe = new AnonymousPipeServerStream(PipeDirection.Out, System.IO.HandleInheritability.Inheritable);
readPipe = new AnonymousPipeServerStream(PipeDirection.In, System.IO.HandleInheritability.Inheritable);
@@ -42,8 +46,8 @@ namespace Barotrauma.Networking
public static void ClosePipes()
{
writePipe?.Close();
readPipe?.Close();
writePipe?.Dispose(); writePipe = null;
readPipe?.Dispose(); readPipe = null;
shutDown = true;
}
@@ -54,5 +58,20 @@ namespace Barotrauma.Networking
PrivateShutDown();
}
public static string CrashString { get; private set; }
public static string CrashReportFilePath { get; private set; }
public static LocalizedString CrashMessage
=> string.IsNullOrEmpty(CrashReportFilePath)
? TextManager.Get("ServerProcessClosed")
: TextManager.GetWithVariable("ServerProcessCrashed", "[reportfilepath]", CrashReportFilePath);
static partial void HandleCrashString(string str)
{
DebugConsole.ThrowError($"The server has crashed: {str}");
CrashReportFilePath = str.Split("||").FirstOrDefault() ?? "servercrashreport.log";
CrashString = str;
}
}
}