mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
auto crash handling
This commit is contained in:
parent
a28a68bcf8
commit
9c143b1249
2 changed files with 26 additions and 2 deletions
|
@ -123,6 +123,27 @@ namespace ShiftOS.Server
|
|||
Console.WriteLine("Client connected.");
|
||||
server.DispatchTo(a.Guid, new NetObject("welcome", new ServerMessage { Name = "Welcome", Contents = a.Guid.ToString(), GUID = "Server" }));
|
||||
};
|
||||
|
||||
server.OnClientDisconnected += (o, a) =>
|
||||
{
|
||||
Console.WriteLine("Client disconnected.");
|
||||
};
|
||||
|
||||
server.OnClientRejected += (o, a) =>
|
||||
{
|
||||
Console.WriteLine("FUCK. Something HORRIBLE JUST HAPPENED.");
|
||||
};
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (o, a) =>
|
||||
{
|
||||
ChatBackend.Broadcast("**Automatic Broadcast:** The multi-user domain is restarting because of a crash.");
|
||||
#if DEBUG
|
||||
ChatBackend.Broadcast("Crash summary: " + a.ExceptionObject.ToString());
|
||||
#endif
|
||||
if(server.IsOnline == true)
|
||||
server.Stop();
|
||||
System.Diagnostics.Process.Start("ShiftOS.Server.exe");
|
||||
};
|
||||
|
||||
server.OnReceived += (o, a) =>
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace ShiftOS.Server
|
|||
sve.Codepoints = rnd.Next(startCP, maxAmt);
|
||||
|
||||
//FS treasure generation.
|
||||
|
||||
/*
|
||||
//create a ramdisk dir
|
||||
var dir = new ShiftOS.Objects.ShiftFS.Directory();
|
||||
//name the directory after the user
|
||||
|
@ -181,16 +181,19 @@ namespace ShiftOS.Server
|
|||
WriteAllBytes(kv.Value, File.ReadAllBytes(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//save the save file to disk.
|
||||
File.WriteAllText("deadsaves/" + sve.Username + ".save", Newtonsoft.Json.JsonConvert.SerializeObject(sve, Newtonsoft.Json.Formatting.Indented));
|
||||
//We don't care about the encryption algorithm because these saves can't be logged into as regular users.
|
||||
|
||||
/*
|
||||
//Now we export the mount.
|
||||
string exportedMount = ExportMount(mountid);
|
||||
//And save it to disk.
|
||||
File.WriteAllText("deadsaves/" + sve.Username + ".mfs", exportedMount);
|
||||
*/
|
||||
|
||||
|
||||
Thread.Sleep((60 * 60) * 1000); //approx. 1 hour.
|
||||
|
||||
|
|
Loading…
Reference in a new issue