Example #1
0
        public BackupEverySave(PersistentList <T> list, string listPath, string pathToSaveTheBackup, int maxNumberOfFilesToKeep = 10)
        {
            var backup = new FileSystemBackup(listPath, pathToSaveTheBackup, maxNumberOfFilesToKeep);

            list.Saved += (sender, args) => {
                Task.Run(() => {
                    try {
                        var backupPath = backup.Backup();
                        BackupAttempted?.Invoke(this, new BackupAttemptedEventArgs(backupPath));
                    }
                    catch (BackupException ex) {
                        BackupAttempted?.Invoke(this, new BackupAttemptedEventArgs(ex));
                    }
                });
            };
        }
Example #2
0
 public DailyBackup(int hourBase, string listPath, string pathToSaveTheBackup, int maxNumberOfFilesToKeep = 10)
 {
     _hourBase = hourBase;
     _backup   = new FileSystemBackup(listPath, pathToSaveTheBackup, maxNumberOfFilesToKeep);
 }