Inheritance: MonoBehaviour
Exemple #1
0
        public async Task OnHttpPageRequest(HttpContext httpContext, string filename)
        {
            Session session = null;

            if (httpContext.Request.Headers.TryGetValue("Authorization", out var value))
            {
                string[] data = value[0].Split(" ", 2);
                if (data.Length == 2 && data[0].Equals("Bearer"))
                {
                    session = SessionManager.GetSession(data[1]);
                }
            }
            switch (filename.ToLower())
            {
            case "/api/start":
                await StartServer.OnRequest(httpContext, session);

                break;

            case "/api/stop":
                await StopServer.OnRequest(httpContext, session);

                break;

            case "/api/restart":
                await RestartServer.OnRequest(httpContext, session);

                break;

            case "/api/kill":
                await KillServer.OnRequest(httpContext, session);

                break;

            case "/api/stats":
                await GetServerStatus.OnRequest(httpContext, session);

                break;

            case "/api/servers":
                await GetServers.OnRequest(httpContext, session);

                break;

            case "/api/server":
                await GetServer.OnRequest(httpContext, session);

                break;

            case "/api/command":
                await SendCommand.OnRequest(httpContext, session);

                break;

            case "/api/login":
                await Login.OnRequest(httpContext);

                break;
            }
        }
Exemple #2
0
 void RaiseCanExecuteChanged()
 {
     StartServer.RaiseCanExecuteChanged();
     StopServer.RaiseCanExecuteChanged();
 }