예제 #1
0
파일: Program.cs 프로젝트: Radviger/MultiV
        public MasterModule()
        {
            Get["/servers"] = _ => MasterServerWorker.ToJson();

            Post["/addserver"] = parameters =>
            {
                if (Request.IsLocal())
                {
                    return(403);
                }
                var port          = new StreamReader(Request.Body).ReadToEnd();
                var serverAddress = Request.UserHostAddress + ":" + port;
                Console.WriteLine("[{1}] Adding server \"{0}\".", serverAddress, DateTime.Now.ToString("HH:mm:ss"));
                MasterServerWorker.AddServer(serverAddress);
                return(200);
            };

            Get["/pictures/{pic}"] = parameters => Response.AsFile("welcome" + Path.DirectorySeparatorChar + "pictures" + Path.DirectorySeparatorChar + ((string)parameters.pic));

            Get["/welcome.json"] = _ => WelcomeMessageWorker.ToJson();

            Get["/version"] = _ => VersioningUpdaterWorker.LastClientVersion.ToString();

            Get["/launcherversion"] = _ => VersioningUpdaterWorker.LastSubprocessVersion.ToString();

            Get["/launcher"] = _ => Response.AsFile("updater" + Path.DirectorySeparatorChar + "MultiV.dll");

            Get["/files"] = _ => Response.AsFile("updater" + Path.DirectorySeparatorChar + "files.zip");
        }
예제 #2
0
파일: Program.cs 프로젝트: Radviger/MultiV
        public static void Main(string[] args)
        {
            var url = "http://+:8888";

            using (WebApp.Start <Startup>(url))
            {
                Console.WriteLine("Running on {0}", url);
                VersioningUpdaterWorker.GetVersion();
                WelcomeMessageWorker.UpdateWelcomeMessage();

                while (true)
                {
                    MasterServerWorker.Work();
                    VersioningUpdaterWorker.Work();
                    WelcomeMessageWorker.Work();
                    Thread.Sleep(100);
                }
            }
        }