Beispiel #1
0
    public override void Update(Server server, float dt)
    {
        if (!started)
        {
            started = true;

            int httpPort = server.Port + 1;
            if (server.config.EnableHTTPServer && (!server.IsSinglePlayer))
            {
                try
                {
                    httpServer = new FragLabs.HTTP.HttpServer(new IPEndPoint(IPAddress.Any, httpPort));
                    MainHttpModule m = new MainHttpModule();
                    m.server = server;
                    m.system = this;
                    httpServer.Install(m);
                    foreach (var module in server.httpModules)
                    {
                        httpServer.Install(module.module);
                    }
                    httpServer.Start();
                    Console.WriteLine(server.language.ServerHTTPServerStarted(), httpPort);
                }
                catch
                {
                    Console.WriteLine(server.language.ServerHTTPServerError(), httpPort);
                }
            }
        }
        for (int i = 0; i < server.httpModules.Count; i++)
        {
            ActiveHttpModule m = server.httpModules[i];
            if (httpServer != null)
            {
                if (!m.installed)
                {
                    m.installed = true;
                    httpServer.Install(m.module);
                }
            }
        }
    }
Beispiel #2
0
    public override void Update(Server server, float dt)
    {
        if (!started)
        {
            started = true;

            int httpPort = server.Port + 1;
            if (server.config.EnableHTTPServer && (!server.IsSinglePlayer))
            {
                try
                {
                    httpServer = new FragLabs.HTTP.HttpServer(new IPEndPoint(IPAddress.Any, httpPort));
                    MainHttpModule m = new MainHttpModule();
                    m.server = server;
                    m.system = this;
                    httpServer.Install(m);
                    foreach (var module in server.httpModules)
                    {
                        httpServer.Install(module.module);
                    }
                    httpServer.Start();
                    Console.WriteLine(server.language.ServerHTTPServerStarted(), httpPort);
                }
                catch
                {
                    Console.WriteLine(server.language.ServerHTTPServerError(), httpPort);
                }
            }
        }
        for (int i = 0; i < server.httpModules.Count; i++)
        {
            ActiveHttpModule m = server.httpModules[i];
            if (httpServer != null)
            {
                if (!m.installed)
                {
                    m.installed = true;
                    httpServer.Install(m.module);
                }
            }
        }
    }
Beispiel #3
0
 public void Uninstalled(HttpServer server)
 {
 }
Beispiel #4
0
 public void Installed(HttpServer server)
 {
     stopwatch = new Stopwatch();
     stopwatch.Start();
 }
Beispiel #5
0
 public void Uninstalled(FragLabs.HTTP.HttpServer server)
 {
 }