public bool CreateLink(Game game) { if (game.State != Game.SaveState.NoLink && game.State != Game.SaveState.PartialLink) { return false; } if (Directory.Exists(game.OriginalPathFull)) { throw new Exception("Directory should not exist"); } JunctionPoint.Create(game.OriginalPathFull, game.StoragePathFull, true); game.UpdateSaveState(); return (game.State == Game.SaveState.FullLink); }
public bool RemoveLink(Game game) { if (game.State != Game.SaveState.FullLink) { return false; } Directory.Delete(game.OriginalPathFull); game.UpdateSaveState(); return (game.State == Game.SaveState.PartialLink); }
public bool ShowPath(Game game, String path, bool show = true) { if (!show && game != null && path != game.OriginalPathFull) { if (DirectoryEx.HasNonHidden(path)) { Trace.WriteLine(String.Format("{0}.ShowPath({1}, {2}) Skipping directory, not empty {3}", this.GetType(), path, show, path)); return false; } } if (show) { if (!DirectoryEx.Show(path)) { Trace.WriteLine(String.Format("{0}.ShowPath({1}, {2}) Failed to change attributes for path {3}", this.GetType(), path, show, path)); return false; } } else { if (!DirectoryEx.Hide(path)) { Trace.WriteLine(String.Format("{0}.ShowPath({1}, {2}) Failed to change attributes for path {3}", this.GetType(), path, show, path)); return false; } } return true; }
public bool MoveSaves(Game game, bool original) { if (game.State == Game.SaveState.Missing || game.State == Game.SaveState.Conflict) { return false; } if (original) { if (game.State == Game.SaveState.FullLink) { return false; } FileSystem.MoveDirectory(game.StoragePathFull, game.OriginalPathFull, UIOption.AllDialogs); game.UpdateSaveState(); return (game.State == Game.SaveState.NoLink); } else { if (game.State != Game.SaveState.NoLink) { return false; } FileSystem.MoveDirectory(game.OriginalPathFull, game.StoragePathFull, UIOption.AllDialogs); game.UpdateSaveState(); return (game.State == Game.SaveState.PartialLink); } }