From d5ab22629ba39ac9f0fae6768b527e82670f96fc Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 2 Feb 2017 17:11:14 -0500 Subject: Implement the Downloader --- ShiftOS.Server/Program.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ShiftOS.Server') diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index 138764f..c0c27ed 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -655,6 +655,29 @@ Contents: } break; + case "download_start": + if (File.Exists(msg.Contents)) + { + server.DispatchTo(new Guid(msg.GUID), new NetObject("download", new ServerMessage + { + Name = "download_meta", + GUID = "server", + Contents = JsonConvert.SerializeObject(File.ReadAllBytes(msg.Contents)) + })); + } + else + { + server.DispatchTo(new Guid(msg.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." + })); + + } + break; case "shiftnet_get": string surl = args["url"] as string; while (surl.EndsWith("/")) -- cgit v1.2.3