public Task RunSteamCmdUpdaterAsync(CancellationToken cancellationToken)
        {
            if (!File.Exists(_settings.SteamCmdPath))
            {
                throw new NotSupportedException(
                          $"There is no executable for steamcmd on given path {_settings.SteamCmdPath}");
            }

            return(Task.Factory.StartNew(() =>
            {
                if (!Directory.Exists(_settings.ServerInstallDir))
                {
                    Directory.CreateDirectory(_settings.ServerInstallDir);
                }

                var steamCmdArgs =
                    $"+login anonymous +force_install_dir \"{_settings.ServerInstallDir}\" +app_update {ConanExilesServerSteamAppId} +quit";

                _process = ProcessWrapper.Create(_settings.SteamCmdPath)
                           .WithArgs(steamCmdArgs)
                           .Start();

                _process.OutputDataReceived += (e, args) => Console.WriteLine(args.Data);
                _process.ErrorDataReceived += (e, args) => Console.Error.WriteLine(args.Data);

                _process.Wait();
            }, cancellationToken));
        }
예제 #2
0
        public void Run()
        {
            if (!File.Exists(_settings.ServerExePath))
            {
                throw new NotSupportedException(
                          $"There is no executable for the server on given path {_settings.ServerExePath}");
            }

            _process = ProcessWrapper
                       .Create(_settings.ServerExePath)
                       .WithArgs("-server", "-log")
                       .Start();

            _process.OutputDataReceived += (e, args) => Console.WriteLine(args.Data);
            _process.ErrorDataReceived  += (e, args) => Console.Error.WriteLine(args.Data);

            _process.Wait();
        }