Пример #1
0
        public void CreateServerConfigs(string serverGame, string serverName)
        {
            switch (serverGame)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();

                string port = GetAvailablePort(gameServer.port);
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), port, gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();

                string port = GetAvailablePort(gameServer.port);
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), port, gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }
            }
        }
Пример #2
0
        public async Task <Process> Run(string serverGame)
        {
            switch (serverGame)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(serverConfig.ServerID);
                return(await gameServer.Install());
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(serverConfig.ServerID);
                return(await gameServer.Install());
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(serverConfig.ServerID);
                return(await gameServer.Install());
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(serverConfig.ServerID);
                await gameServer.Install();

                return(null);
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(serverConfig.ServerID);
                return(await gameServer.Install());
            }

            case (GameServer.CS.FullName):
            {
                GameServer.CS gameServer = new GameServer.CS(serverConfig.ServerID);
                return(await gameServer.Install());
            }

            case (GameServer.CSCZ.FullName):
            {
                GameServer.CSCZ gameServer = new GameServer.CSCZ(serverConfig.ServerID);
                return(await gameServer.Install());
            }

            default: break;
            }

            return(null);
        }
Пример #3
0
        public async Task <Process> Run()
        {
            Process process = null;

            switch (server.Game)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(server.ID);
                process = await gameServer.Start();

                Error = gameServer.Error;

                break;
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.CS.FullName):
            {
                GameServer.CS gameServer = new GameServer.CS(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.CSCZ.FullName):
            {
                GameServer.CSCZ gameServer = new GameServer.CSCZ(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.HL2DM.FullName):
            {
                GameServer.HL2DM gameServer = new GameServer.HL2DM(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.L4D2.FullName):
            {
                GameServer.L4D2 gameServer = new GameServer.L4D2(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.MC.FullName):
            {
                GameServer.MC gameServer = new GameServer.MC(server.ID);
                gameServer.SetParameter(additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer.GTA5.FullName):
            {
                GameServer.GTA5 gameServer = new GameServer.GTA5(server.ID);
                gameServer.SetParameter(additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            case (GameServer._7DTD.FullName):
            {
                GameServer._7DTD gameServer = new GameServer._7DTD(server.ID);
                gameServer.SetParameter(additionalParam);
                process = await gameServer.Start();

                Error  = gameServer.Error;
                Notice = gameServer.Notice;

                break;
            }

            default: break;
            }

            return(process);
        }
Пример #4
0
        public async Task <bool> Run(Process process)
        {
            switch (server.Game)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(server.ID);
                await gameServer.Stop(process);

                break;
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(server.ID);
                await gameServer.Stop(process);

                break;
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(server.ID);
                await gameServer.Stop(process);

                break;
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(server.ID);
                await gameServer.Stop(process);

                break;
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(server.ID);
                await gameServer.Stop(process);

                break;
            }

            case (GameServer.CS.FullName):
            {
                GameServer.CS gameServer = new GameServer.CS(server.ID);
                await gameServer.Stop(process);

                break;
            }

            case (GameServer.CSCZ.FullName):
            {
                GameServer.CSCZ gameServer = new GameServer.CSCZ(server.ID);
                await gameServer.Stop(process);

                break;
            }

            default: return(true);
            }

            if (!process.HasExited)
            {
                process.Kill();
            }

            return(true);
        }
Пример #5
0
        public async Task <bool> Run()
        {
            bool updated = false;

            switch (server.Game)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.CS.FullName):
            {
                GameServer.CS gameServer = new GameServer.CS(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.CSCZ.FullName):
            {
                GameServer.CSCZ gameServer = new GameServer.CSCZ(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.HL2DM.FullName):
            {
                GameServer.HL2DM gameServer = new GameServer.HL2DM(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.L4D2.FullName):
            {
                GameServer.L4D2 gameServer = new GameServer.L4D2(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.MC.FullName):
            {
                GameServer.MC gameServer = new GameServer.MC(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer.GTA5.FullName):
            {
                GameServer.GTA5 gameServer = new GameServer.GTA5(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            case (GameServer._7DTD.FullName):
            {
                GameServer._7DTD gameServer = new GameServer._7DTD(server.ID);
                updated = await gameServer.Update();

                Error = gameServer.Error;
                break;
            }

            default: break;
            }

            return(updated);
        }
Пример #6
0
        public Process Run()
        {
            Process process = null;

            switch (server.Game)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(server.ID);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.CS.FullName):
            {
                GameServer.CS gameServer = new GameServer.CS(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.CSCZ.FullName):
            {
                GameServer.CSCZ gameServer = new GameServer.CSCZ(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.HL2DM.FullName):
            {
                GameServer.HL2DM gameServer = new GameServer.HL2DM(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            case (GameServer.L4D2.FullName):
            {
                GameServer.L4D2 gameServer = new GameServer.L4D2(server.ID);
                gameServer.SetParameter(server.IP, server.Port, server.Defaultmap, server.Maxplayers, gslt, additionalParam);
                (process, Error, Notice) = gameServer.Start();

                break;
            }

            default: break;
            }

            return(process);
        }
Пример #7
0
        public void CreateServerConfigs(string serverGame, string serverName)
        {
            switch (serverGame)
            {
            case (GameServer.CSGO.FullName):
            {
                GameServer.CSGO gameServer = new GameServer.CSGO(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.GMOD.FullName):
            {
                GameServer.GMOD gameServer = new GameServer.GMOD(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.TF2.FullName):
            {
                GameServer.TF2 gameServer = new GameServer.TF2(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.MCPE.FullName):
            {
                GameServer.MCPE gameServer = new GameServer.MCPE(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.RUST.FullName):
            {
                GameServer.RUST gameServer = new GameServer.RUST(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.CS.FullName):
            {
                GameServer.CS gameServer = new GameServer.CS(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.CSCZ.FullName):
            {
                GameServer.CSCZ gameServer = new GameServer.CSCZ(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.HL2DM.FullName):
            {
                GameServer.HL2DM gameServer = new GameServer.HL2DM(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.L4D2.FullName):
            {
                GameServer.L4D2 gameServer = new GameServer.L4D2(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.MC.FullName):
            {
                GameServer.MC gameServer = new GameServer.MC(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer.GTA5.FullName):
            {
                GameServer.GTA5 gameServer = new GameServer.GTA5(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }

            case (GameServer._7DTD.FullName):
            {
                GameServer._7DTD gameServer = new GameServer._7DTD(serverConfig.ServerID);
                serverConfig.CreateServerDirectory();
                serverConfig.CreateWindowsGSMConfig(serverGame, serverName, GetIPAddress(), GetAvailablePort(gameServer.port), gameServer.defaultmap, gameServer.maxplayers, "", gameServer.additional);

                break;
            }
            }
        }