Пример #1
0
        public AnthillaSPModule()
            : base("/anthillasp")
        {
            this.RequiresAuthentication();

            Get["/"] = x => {
                return(View["page-m-service-sp"]);
            };

            Get["/unit/set/anthillasp"] = x => {
                CreateUnit.ForAnthillaSP();
                AnthillaSP.EnableAnthillaSP();
                return(Response.AsJson(true));
            };

            Get["/unit/set/anthillaserver"] = x => {
                CreateUnit.ForAnthillaServer();
                AnthillaSP.EnableAnthillaServer();
                return(Response.AsJson(true));
            };

            Get["/unit/start/anthillasp"] = x => {
                CommandModel start = AnthillaSP.StartAnthillaSP();
                return(View["page-m-service-sp", start]);
                //return Response.AsJson(start);
            };

            Get["/unit/start/anthillaserver"] = x => {
                CommandModel start = AnthillaSP.StartAnthillaServer();
                return(View["page-m-service-sp", start]);
                //return Response.AsJson(start);
            };

            Get["/unit/stop/anthillasp"] = x => {
                CommandModel stop = AnthillaSP.StopAnthillaSP();
                return(View["page-m-service-sp", stop]);
                //return Response.AsJson(stop);
            };

            Get["/unit/stop/anthillaserver"] = x => {
                CommandModel stop = AnthillaSP.StopAnthillaServer();
                return(View["page-m-service-sp", stop]);
                //return Response.AsJson(stop);
            };

            Get["/unit/status/anthillasp"] = x => {
                CommandModel status = AnthillaSP.StatusAnthillaSP();
                return(View["page-m-service-sp", status]);
                //return Response.AsJson(status);
            };

            Get["/unit/status/anthillaserver"] = x => {
                CommandModel status = AnthillaSP.StatusAnthillaServer();
                return(View["page-m-service-sp", status]);
                //return Response.AsJson(status);
            };
        }