示例#1
0
        public async Task <bool> StartUpdater()
        {
            _quitEvent = new ManualResetEvent(false);
            await Task.Run(() => {
                Log.Information("ConanExilesUpdater Started Running {DateAndTime}", DateTime.UtcNow);

                CheckForUpdate();

                if (_settings.Update.ShouldInstallSteamCmdIfMissing)
                {
                    InstallSteamCmd();
                }

                if (_settings.Update.ShouldInstallConanServerIfMissing)
                {
                    InstallConanServer();
                }

                if (_settings.Update.UpdateOnLaunch)
                {
                    var process = Process.GetProcesses().Where(c => c.ProcessName.Contains("ConanSandboxServer")).FirstOrDefault();
                    if (process == null)
                    {
                        var doUpdate = DetectUpdate();
                        if (doUpdate)
                        {
                            DoServerUpdateInstall();
                            StartConan();
                        }
                    }
                }

                if (_settings.Update.AnnounceTwitch)
                {
                    _twitchClient = new TwitchService(_settings);
                }
                if (_settings.Update.AnnounceDiscord)
                {
                    _discordClient = new DiscordService(_settings);
                }
                if (_settings.Update.AnnounceRCON)
                {
                    _rconClient = new RCONService(_settings);
                }

                _general = new GeneralServices(_settings, _discordClient, _twitchClient, _rconClient, _messages);
                _general.StartServices();
                RunUpdateChecks();
                _quitEvent.WaitOne();
            });

            return(true);
        }
示例#2
0
 public GeneralServices(Settings settings, DiscordService discord, TwitchService twitch)
 {
     _settings      = settings;
     _discordClient = discord;
     _twitchService = twitch;
 }