private bool ValidateSaveFile(string fileName = null) { fileName = fileName ?? Filesystem.GetHotSeatSaveFileFullName(Settings.Default.HotSeatFolder, Filesystem.GetSaveFileName(game)); return(File.Exists(fileName)); }
public void Update() { Logger.Info("Checking for update"); LastUpdateCheck = DateTimeOffset.Now; var hasUpdated = gameRepository.HasUpdated(game) || Filesystem.GetSaveFileLastWrite(game, Settings.Default.HotSeatFolder) < gameRepository.GetSaveGameLastModifiedTime(game); if (hasUpdated) { var remoteSavefileLastModified = gameRepository.GetSaveGameLastModifiedTime(game); var remoteFileIsNewer = SaveGameTime < remoteSavefileLastModified; if (remoteFileIsNewer) { Logger.Info($"Detected newer remote save file for {game}"); saveFileWatcher.EnableRaisingEvents = false; var fullSavefileName = Filesystem.GetHotSeatSaveFileFullName(Settings.Default.HotSeatFolder, Filesystem.GetSaveFileName(game)); game = gameRepository.UpdateGameAndSaveFile(game, fullSavefileName); FirePropertiesChanged(nameof(SaveGameTime), nameof(CurrentPlayer), nameof(Players), nameof(Name), nameof(IsMyTurn), nameof(LastUpdateCheck)); saveFileWatcher.EnableRaisingEvents = true; } } }
private BlobClient CreateBlobClientForGame(Game game) => new BlobClient(connectionString, ContainerName, Filesystem.GetSaveFileName(game));