diff options
Diffstat (limited to '')
-rw-r--r-- | partitionmanager.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp index b2d7b4e02..721537496 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -651,9 +651,11 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde pos = section_time / (float) total_time; //DataManager::ShowProgress(pos, section_time); + TWFunc::SetPerformanceMode(true); time(&start); if (Part->Backup(Backup_Folder, &total_size, ¤t_size)) { + bool md5Success = false; current_size += Part->Backup_Size; pos = (float)((float)(current_size) / (float)(total_size)); DataManager::SetProgress(pos); @@ -662,12 +664,16 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) { if ((*subpart)->Can_Be_Backed_Up && (*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point) { - if (!(*subpart)->Backup(Backup_Folder, &total_size, ¤t_size)) + if (!(*subpart)->Backup(Backup_Folder, &total_size, ¤t_size)) { + TWFunc::SetPerformanceMode(false); return false; + } sync(); sync(); - if (!Make_MD5(generate_md5, Backup_Folder, (*subpart)->Backup_FileName)) + if (!Make_MD5(generate_md5, Backup_Folder, (*subpart)->Backup_FileName)) { + TWFunc::SetPerformanceMode(false); return false; + } if (Part->Backup_Method == 1) { *file_bytes_remaining -= (*subpart)->Backup_Size; } else { @@ -689,8 +695,12 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde *img_bytes_remaining -= Part->Backup_Size; *img_time += backup_time; } - return Make_MD5(generate_md5, Backup_Folder, Part->Backup_FileName); + + md5Success = Make_MD5(generate_md5, Backup_Folder, Part->Backup_FileName); + TWFunc::SetPerformanceMode(false); + return md5Success; } else { + TWFunc::SetPerformanceMode(false); return false; } } @@ -862,21 +872,27 @@ int TWPartitionManager::Run_Backup(void) { bool TWPartitionManager::Restore_Partition(TWPartition* Part, string Restore_Name, int partition_count, const unsigned long long *total_restore_size, unsigned long long *already_restored_size) { time_t Start, Stop; + TWFunc::SetPerformanceMode(true); time(&Start); //DataManager::ShowProgress(1.0 / (float)partition_count, 150); - if (!Part->Restore(Restore_Name, total_restore_size, already_restored_size)) + if (!Part->Restore(Restore_Name, total_restore_size, already_restored_size)) { + TWFunc::SetPerformanceMode(false); return false; + } if (Part->Has_SubPartition) { std::vector<TWPartition*>::iterator subpart; for (subpart = Partitions.begin(); subpart != Partitions.end(); subpart++) { if ((*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point) { - if (!(*subpart)->Restore(Restore_Name, total_restore_size, already_restored_size)) + if (!(*subpart)->Restore(Restore_Name, total_restore_size, already_restored_size)) { + TWFunc::SetPerformanceMode(false); return false; + } } } } time(&Stop); + TWFunc::SetPerformanceMode(false); gui_print("[%s done (%d seconds)]\n\n", Part->Backup_Display_Name.c_str(), (int)difftime(Stop, Start)); return true; } |