From 0f19359ef042805ac645a1817a5c95b722c96a37 Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Wed, 8 Mar 2017 01:43:25 +0000 Subject: [PATCH] They're all bears on unicycles... --- ShiftOS.Server/ShiftnetBackend.cs | 44 ++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/ShiftOS.Server/ShiftnetBackend.cs b/ShiftOS.Server/ShiftnetBackend.cs index 60b3aa4..c7bf0e8 100644 --- a/ShiftOS.Server/ShiftnetBackend.cs +++ b/ShiftOS.Server/ShiftnetBackend.cs @@ -43,37 +43,49 @@ namespace ShiftOS.Server string url = contents as string; if (!url.StartsWith("shiftnet/")) { - server.DispatchTo(new Guid(guid), new NetObject("shiftnet_got", new ServerMessage + try { - Name = "shiftnet_file", - GUID = "server", - Contents = (File.Exists("badrequest.md") == true) ? File.ReadAllText("badrequest.md") : @"# Bad request. + + server.DispatchTo(new Guid(guid), new NetObject("shiftnet_got", new ServerMessage + { + Name = "shiftnet_file", + GUID = "server", + Contents = (File.Exists("badrequest.md") == true) ? File.ReadAllText("badrequest.md") : @"# Bad request. You have sent a bad request to the multi-user domain. Please try again." - })); + })); + } + catch { } return; } if (File.Exists(url)) { - server.DispatchTo(new Guid(guid), new NetObject("download", new ServerMessage + try { - Name = "download_meta", - GUID = "server", - Contents = JsonConvert.SerializeObject(File.ReadAllBytes(url)) - })); + server.DispatchTo(new Guid(guid), new NetObject("download", new ServerMessage + { + Name = "download_meta", + GUID = "server", + Contents = JsonConvert.SerializeObject(File.ReadAllBytes(url)) + })); + } + catch { } } else { - server.DispatchTo(new Guid(guid), new NetObject("shiftnet_got", new ServerMessage + try { - Name = "shiftnet_file", - GUID = "server", - Contents = (File.Exists("notfound.md") == true) ? File.ReadAllText("notfound.md") : @"# Not found. + server.DispatchTo(new Guid(guid), new NetObject("shiftnet_got", new ServerMessage + { + Name = "shiftnet_file", + GUID = "server", + Contents = (File.Exists("notfound.md") == true) ? File.ReadAllText("notfound.md") : @"# Not found. The page you requested at was not found on this multi-user domain." - })); - + })); + } + catch { } } }