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")));
        }
Example #2
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);
        }