public void Extract(BackupPackage backup, string target) { Task.Run(() => { DirectoryInfo dir = new DirectoryInfo(target); if (!dir.Exists) { dir.Create(); } LastProgress = new BackupProgressArgs(BackupProgressState.Saving, 0, 0); Extract(backup.Package.FullName, backup.BackupInfo.Hash, target); LastProgress = new BackupProgressArgs(BackupProgressState.Finished, LastProgress.FilesDone, LastProgress.FileTotal); }); }
public void Reload() { Backups.Clear(); foreach (FileInfo file in Target.GetFiles().Where((i) => { return(i.Extension.Equals(".bck")); })) { try { BackupInfo info = BackupInfo.read(file.FullName); BackupPackage package = new BackupPackage(file.Directory, info); Backups.Add(package); } catch (Exception) { Console.WriteLine("Invalid backup info: " + file.Name.ToString()); } } }