/// <summary> /// Backups a file at the specified path for later retrieval /// </summary> /// <param name="game"></param> /// <param name="path"></param> /// <returns></returns> public BackupFile BackupFile(HandlerData game, string path) { string appData = ApplicationUtil.GetAppDataPath(); string gamePath = Path.Combine(appData, game.GameID); string destination = Path.Combine(gamePath, Path.GetFileName(path)); if (!File.Exists(path)) { if (File.Exists(destination)) { // we f****d up and the backup exists? maybe, so restore File.Copy(destination, path); } } else { if (File.Exists(destination)) { File.Delete(destination); } File.Copy(path, destination); } BackupFile bkp = new BackupFile(path, destination); backupFiles.Add(bkp); return(bkp); }
/// <summary> /// Begins a game session for backup /// </summary> /// <param name="game"></param> public void BeginBackup(HandlerData game) { string appData = ApplicationUtil.GetAppDataPath(); string gamePath = Path.Combine(appData, game.GameID); Directory.CreateDirectory(gamePath); backupFiles = new List <BackupFile>(); }
public ContentManager(GameHandlerMetadata info, HandlerData game) { this.game = game; loadedImages = new Dictionary <string, Image>(); handlersFolder = GameManager.Instance.GetInstalledPackagePath(); pkgFolder = PackageManager.GetInstallPath(info); info.RootDirectory = pkgFolder; DefaultImage = new Bitmap(1, 1); }
/// <summary> /// Do a backup revert /// </summary> /// <param name="game"></param> public void ExecuteBackup(HandlerData game) { // we didnt backup anything if (backupFiles == null) { return; } string appData = ApplicationUtil.GetAppDataPath(); string gamePath = Path.Combine(appData, game.GameID); for (int i = 0; i < backupFiles.Count; i++) { BackupFile bkp = backupFiles[i]; if (File.Exists(bkp.BackupPath)) { File.Delete(bkp.Source); File.Move(bkp.BackupPath, bkp.Source); } } }
public void InitializeDefault(HandlerData game) { if (playerData == null) { playerData = new List <PlayerInfo>(); } if (screens == null) { screens = new List <UserScreen>(); } if (options == null) { options = new Dictionary <string, object>(); foreach (var opt in game.Options) { options.Add(opt.Key, opt.Value); } } }
public abstract bool Initialize(GameHandler handler, HandlerData handlerData, UserGameInfo game, GameProfile profile);
public static string GetTempFolder(HandlerData game) { string appData = ApplicationUtil.GetAppDataPath(); return(Path.Combine(appData, "temp", game.GameID)); }