コード例 #1
0
ファイル: BackupManager.cs プロジェクト: molekm/nucleuscoop
        /// <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);
        }
コード例 #2
0
ファイル: BackupManager.cs プロジェクト: molekm/nucleuscoop
        /// <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>();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: BackupManager.cs プロジェクト: molekm/nucleuscoop
        /// <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);
                }
            }
        }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
 public abstract bool Initialize(GameHandler handler, HandlerData handlerData, UserGameInfo game, GameProfile profile);
コード例 #7
0
        public static string GetTempFolder(HandlerData game)
        {
            string appData = ApplicationUtil.GetAppDataPath();

            return(Path.Combine(appData, "temp", game.GameID));
        }