Example #1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            //App_Start Configuration
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Inform the game loop about its environment
            GameLoop.Instance.MachineName = System.Environment.MachineName.ToLower();
            GameLoop.Instance.VirtualPath = HostingEnvironment.ApplicationVirtualPath;
            GameLoop.Instance.SetEngine();

            // Get latest codes from the WebService
            var dms = new DescilMturkService(new PersistedRepository());
            dms.GetCodes();

            try
            {
                using (var db = new PersistedRepository()) { db.Log.AddEvent("ApplicationStart"); }
            }
            catch
            {
                //Swallow this
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["key"]))
            {
                string key = Request.QueryString["key"];

                var config = new Configuration();
                if(key != config.AppSettings("SegregServiceKey"))
                {
                    return;
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {
                string op = Request.QueryString["op"].ToLower();
                switch (op)
                {
                    case "reboot":
                        HttpRuntime.UnloadAppDomain();
                        break;
                    case "start":
                        GameLoop.Instance.StartEngineLoop();
                        GameLoop.Instance.StartGameLoop();
                        //GameLoop.Instance.StartSweepLoop();
                        break;
                    case "stop":
                        GameLoop.Instance.StopEngineLoop();
                        GameLoop.Instance.StopGameLoop();
                        //GameLoop.Instance.StopSweepLoop();
                        break;
                    case "startengineloop":
                        GameLoop.Instance.StartEngineLoop();
                        break;
                    case "stopengineloop":
                        GameLoop.Instance.StopEngineLoop();
                        break;
                    case "startgameloop":
                        GameLoop.Instance.StartGameLoop();
                        break;
                    case "stopgameloop":
                        GameLoop.Instance.StopGameLoop();
                        break;
                    case "startsweeploop":
                        GameLoop.Instance.StartSweepLoop();
                        break;
                    case "stopsweeploop":
                        GameLoop.Instance.StopSweepLoop();
                        break;
                    case "step":
                        GameLoop.Instance.Step();
                        break;
                    case "getcodes":
                        var dms = new DescilMturkService(new PersistedRepository());
                        dms.GetCodes();
                        break;
                }
            }
        }