Пример #1
0
        /// <summary>
        ///如果升级程序存在,则启动升级程序,否则告诉控制端更新失败
        /// </summary>
        private void builtUpdateServer()
        {
            string path = Directory.GetCurrentDirectory() + "\\Update.exe";

            //如果Update程序已经启动,先关闭它.
            ServerUpdater.CloseApplication("update");
            if (!File.Exists(path))
            {
                BaseCode code = new BaseCode();
                code.Head = CodeHead.UPDATE_FAIL;
                mainServer.SendCode(code);
            }
            else
            {
                Thread.Sleep(300);
                //启动Update程序
                Thread updateThread = new Thread(new ThreadStart(runUpdateApp));
                updateThread.Start();
                //告诉控制端Update程序已经启动.
                Thread.Sleep(100);
                PortCode code = new PortCode();
                code.Head = CodeHead.UPDATE_READY;
                code.Port = Constant.Port_Update;
                mainServer.SendCode(code);
            }
        }
Пример #2
0
        private static void Main(string[] args)
        {
            Updater           = new ServerUpdater();
            Updater.OnUpdate += SyncMissionHandler.Update;

            string ip         = "127.0.0.1";
            string configPath = Path.Combine(Directory.GetCurrentDirectory(), "config.ini");

            if (File.Exists(configPath))
            {
                FileStream   fs = new FileStream(configPath, FileMode.Open);
                StreamReader sr = new StreamReader(fs);
                ip = sr.ReadLine();
                sr.Close();
                fs.Close();
            }

            SKServer = new SwiftKernelServer();
            SKServer.Setup(IPAddress.Parse(ip), 6000, "pkillers");

            SKServer.OnPeerConnected    += Server_OnPeerConnected;
            SKServer.OnPeerDisconnected += Server_OnPeerDisconnected;
            SKServer.OnRequestReceived  += Server_OnRequestReceived;

            RoomControllers.Add(new RoomController(new Room("Test Room", null)));

            SKServer.Start();
        }
Пример #3
0
        /// <summary>
        ///如果升级程序存在,则启动升级程序,否则告诉控制端更新失败
        /// </summary>
        private void builtUpdateServer()
        {
            string path = Directory.GetCurrentDirectory() + "\\Update.exe";

            // string path = @"D:\My Documents\Visual Studio 2005\Projects\程序设计大赛\ICANSEEYOU\Update\bin\Debug\Update.exe";
            //如果Update程序已经启动,先关闭它.
            ServerUpdater.CloseApplication("update");
            if (!File.Exists(path))
            {
                BaseCode code = new BaseCode();
                code.Head = CodeHead.UPDATE_FAIL;
                mainChick.SendCode(code);
            }
            else
            {
                Thread.Sleep(300);
                //启动Update程序
                Thread updateThread = new Thread(new ThreadStart(runUpdateApp));
                updateThread.Start();
                //告诉控制端Update程序已经启动.
                Thread.Sleep(100);
                PortCode code = new PortCode();
                code.Head = CodeHead.UPDATE_READY;
                code.Port = Constant.Port_Update;
                mainChick.SendCode(code);
            }
        }
        public async Task DownloadAndExtractSteamCmdToTempPath()
        {
            // Arrange
            var updater = new ServerUpdater(_settings);

            // Act
            if (Directory.Exists(_settings.SteamCmdInstallDir))
            {
                Directory.Delete(_settings.SteamCmdInstallDir, true);
            }

            await updater.EnsureSteamCmdExistsAsync(_cts.Token);

            // Assert
            Assert.True(File.Exists(_settings.SteamCmdPath));
        }
        public async Task RunSteamCmdUpdaterAndInstallToTempPath()
        {
            // Arrange
            var updater = new ServerUpdater(_settings);

            // Act
            if (Directory.Exists(_settings.SteamCmdInstallDir))
            {
                Directory.Delete(_settings.SteamCmdInstallDir, true);
            }

            await updater.EnsureSteamCmdExistsAsync(_cts.Token);

            await updater.RunSteamCmdUpdaterAsync(_cts.Token);

            // Assert
            Assert.True(File.Exists(Path.Combine(_settings.ServerInstallDir, "StartServer.bat")));
        }
Пример #6
0
        private static async Task <int> Execute(string[] args, CancellationToken token)
        {
            var settings = SettingsParser.ParseArgs(CesxSettings.Default, args);

            Console.WriteLine("CESX: starting with settings");
            Console.WriteLine(settings);

            if (!settings.SkipBackup)
            {
                Console.WriteLine("CESX: Creating backup...");
                var backuper = new ServerBackuper(settings);
                backuper.DoBackup();
                Console.WriteLine("CESX: Done!");
            }

            if (!settings.SkipUpdate)
            {
                Console.WriteLine("CESX: Try updating server files");
                _updater = new ServerUpdater(settings);

                Console.WriteLine("CESX: Downloading SteamCmd...");
                await _updater.EnsureSteamCmdExistsAsync(token);

                Console.WriteLine("CESX: Done!");

                Console.WriteLine("CESX: Running steamcmd...");
                await _updater.RunSteamCmdUpdaterAsync(token);

                Console.WriteLine("CESX: Done!");

                //_updater.Dispose();
            }

            Console.WriteLine("CESX: Starting the server instance");
            _server = new ServerRunner(settings);
            _server.Run();

            return((int)ExitCode.Success);
        }
Пример #7
0
 public CleverbotService(Cleverbot cleverbot, ServerUpdater <string> console, DiscordSocketClient client) : base(console, client)
 {
     CleverbotConnect = cleverbot;
     CommandName      = "chat";
 }
Пример #8
0
 public TVroom(SocketVoiceChannel TvChannel, ServerUpdater <string> console)
 {
     Console    = console;
     _TvChannel = TvChannel;
     started    = DateTime.Now;
 }
Пример #9
0
 public TvModeService(ServerUpdater <string> console, DiscordSocketClient client) : base(console, client)
 {
     client.UserVoiceStateUpdated += ProcessVoiceChannelChange;
     CommandName = "tvroom";
 }
Пример #10
0
 public TestService(string prefix, ServerUpdater <string> console)
 {
     this.prefix  = prefix;
     this.console = console;
 }
Пример #11
0
 public APIConnectionScheduled(ServerUpdater <string> console, DiscordSocketClient client, ScheduleMaker scheduleMaker) : base(console, client)
 {
     ScheduleMaker = scheduleMaker;
 }
Пример #12
0
 public APIconnection(ServerUpdater <string> console, DiscordSocketClient client) : base(console, client)
 {
 }
Пример #13
0
 public GWCService(ServerUpdater <string> console, DiscordSocketClient client)
 {
     Console = console;
     Client  = client;
 }
Пример #14
0
 public WeatherUndergroundService(WeatherUnderground weatherUndergroundConnection, ServerUpdater <string> console, DiscordSocketClient client, ScheduleMaker scheduleMaker) : base(console, client, scheduleMaker)
 {
     WeatherUndergroundConnection = weatherUndergroundConnection;
     CommandName = "weather";
 }
Пример #15
0
 public ImgurService(Imgur imgurConnection, ServerUpdater <string> console, DiscordSocketClient client, ScheduleMaker scheduleMaker) : base(console, client, scheduleMaker)
 {
     ImgurConnection = imgurConnection;
     CommandName     = "imgur";
 }