public ArkSaveFileWatcher(ArkServerContext serverContext) { _serverContext = serverContext; _watcher = new FileSystemWatcher(); _watcher.Changed += _watcher_Changed; _watcher.Created += _watcher_Changed; SaveFilePath = serverContext.Config.SaveFilePath; }
public void AddServer(ArkServerContext context) { //context.UpdateQueued += Context_UpdateTriggered; context.UpdateCompleted += Context_UpdateCompleted; context.GameDataUpdated += Context_GameDataUpdated; context.BackupCompleted += Context_BackupCompleted; context._saveFileWatcher.Changed += _saveFileWatcher_Changed; context._contextManager = this; _serverContexts.Add(context.Config.Key, context); }
private void _saveFileWatcher_Changed(ArkServerContext serverContext, ArkSaveFileChangedEventArgs e) { QueueServerUpdate(serverContext); var clusterContext = GetCluster(serverContext.Config.ClusterKey); if (clusterContext == null) { return; } QueueClusterUpdate(clusterContext); }
public async Task StartCountdown(ArkServerContext serverContext, string reason, int delayInMinutes, Func <Task> react = null) { // collection of servers that should receive notifications via rcon for this countdown event var serverContexts = serverContext == null?_contextManager.Servers.Where(x => !x.Config.DisableChatNotifications).ToArray() : new ArkServerContext[] { serverContext }; foreach (var sc in serverContexts) { await sc.Steam.SendRconCommand($"serverchat Countdown started: {reason} in {delayInMinutes} minute{(delayInMinutes > 1 ? "s" : "")}..."); } if (!string.IsNullOrWhiteSpace(_config.Discord.AnnouncementChannel)) { await _discordManager.SendTextMessageToChannelNameOnAllServers(_config.Discord.AnnouncementChannel, $"**Countdown{(serverContext == null ? "" : $" on server {serverContext.Config.Key}")} started: {reason} in {delayInMinutes} minute{(delayInMinutes > 1 ? "s" : "")}...**");
public ArkServerContext GetServer(string key) { if (key == null) { return(null); } ArkServerContext context = null; if (_serverContexts.TryGetValue(key, out context)) { return(context); } return(null); }
public ArkSaveFileWatcherTimer(ArkServerContext serverContext) { _serverContext = serverContext; _timer = new Timer(_timer_Callback, null, TimeSpan.Zero, _delay); }
public void QueueUpdateServerManual(ArkServerContext serverContext) { QueueUpdateManual(serverContext, "Server", serverContext.Config.Key); }
private void Context_BackupCompleted(ArkServerContext sender, bool backupsEnabled, SavegameBackupResult result) { BackupCompleted?.Invoke(sender, backupsEnabled, result); }
public void QueueServerUpdate(ArkServerContext serverContext) { QueueUpdate(serverContext, "Server", serverContext.Config.Key); }