| 8 | |
| 9 | |
| 10 | bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Command) |
| 11 | { |
| 12 | RAROptions *Cmd=Arc.GetRAROptions(); |
| 13 | |
| 14 | HEADER_TYPE HeaderType=Arc.GetHeaderType(); |
| 15 | FileHeader *hd=HeaderType==HEAD_SERVICE ? &Arc.SubHead:&Arc.FileHead; |
| 16 | bool SplitHeader=(HeaderType==HEAD_FILE || HeaderType==HEAD_SERVICE) && |
| 17 | hd->SplitAfter; |
| 18 | |
| 19 | if (DataIO!=NULL && SplitHeader) |
| 20 | { |
| 21 | bool PackedHashPresent=Arc.Format==RARFMT50 || |
| 22 | hd->UnpVer>=20 && hd->FileHash.CRC32!=0xffffffff; |
| 23 | if (PackedHashPresent && |
| 24 | !DataIO->PackedDataHash.Cmp(&hd->FileHash,hd->UseHashKey ? hd->HashKey:NULL)) |
| 25 | uiMsg(UIERROR_CHECKSUMPACKED, Arc.FileName, hd->FileName); |
| 26 | } |
| 27 | |
| 28 | int64 PosBeforeClose=Arc.Tell(); |
| 29 | |
| 30 | if (DataIO!=NULL) |
| 31 | DataIO->ProcessedArcSize+=Arc.FileLength(); |
| 32 | |
| 33 | |
| 34 | Arc.Close(); |
| 35 | |
| 36 | wchar NextName[NM]; |
| 37 | wcsncpyz(NextName,Arc.FileName,ASIZE(NextName)); |
| 38 | NextVolumeName(NextName,ASIZE(NextName),!Arc.NewNumbering); |
| 39 | |
| 40 | #if !defined(SFX_MODULE) && !defined(RARDLL) |
| 41 | bool RecoveryDone=false; |
| 42 | #endif |
| 43 | bool FailedOpen=false,OldSchemeTested=false; |
| 44 | |
| 45 | #if !defined(SILENT) |
| 46 | // In -vp mode we force the pause before next volume even if it is present |
| 47 | // and even if we are on the hard disk. It is important when user does not |
| 48 | // want to process partially downloaded volumes preliminary. |
| 49 | if (Cmd->VolumePause && !uiAskNextVolume(NextName,ASIZE(NextName))) |
| 50 | FailedOpen=true; |
| 51 | #endif |
| 52 | |
| 53 | uint OpenMode = Cmd->OpenShared ? FMF_OPENSHARED : 0; |
| 54 | |
| 55 | if (!FailedOpen) |
| 56 | while (!Arc.Open(NextName,OpenMode)) |
| 57 | { |
| 58 | // We need to open a new volume which size was not calculated |
| 59 | // in total size before, so we cannot calculate the total progress |
| 60 | // anymore. Let's reset the total size to zero and stop |
| 61 | // the total progress. |
| 62 | if (DataIO!=NULL) |
| 63 | DataIO->TotalArcSize=0; |
| 64 | |
| 65 | if (!OldSchemeTested) |
| 66 | { |
| 67 | // Checking for new style volumes renamed by user to old style |
no test coverage detected