Ejemplo n.º 1
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());
            }

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

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

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

                return(null);
            }

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

                return(null);
            }

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

            default: break;
            }

            return(null);
        }
Ejemplo n.º 2
0
#pragma warning disable 1998
        public async 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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, port, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword(), port);

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                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);
                gameServer.CreateServerCFG(serverName, GetRCONPassword());

                break;
            }

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

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

                break;
            }

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

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

                break;
            }

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

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

                break;
            }
            }
        }
Ejemplo n.º 3
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;
            }

            default: break;
            }

            return(process);
        }