| 681 | |
| 682 | #ifndef SFX_MODULE |
| 683 | static void GenArcName(wchar *ArcName,size_t MaxSize,const wchar *GenerateMask,uint ArcNumber,bool &ArcNumPresent) |
| 684 | { |
| 685 | bool Prefix=false; |
| 686 | if (*GenerateMask=='+') |
| 687 | { |
| 688 | Prefix=true; // Add the time string before the archive name. |
| 689 | GenerateMask++; // Skip '+' in the beginning of time mask. |
| 690 | } |
| 691 | |
| 692 | wchar Mask[MAX_GENERATE_MASK]; |
| 693 | wcsncpyz(Mask,*GenerateMask!=0 ? GenerateMask:L"yyyymmddhhmmss",ASIZE(Mask)); |
| 694 | |
| 695 | bool QuoteMode=false,Hours=false; |
| 696 | for (uint I=0;Mask[I]!=0;I++) |
| 697 | { |
| 698 | if (Mask[I]=='{' || Mask[I]=='}') |
| 699 | { |
| 700 | QuoteMode=(Mask[I]=='{'); |
| 701 | continue; |
| 702 | } |
| 703 | if (QuoteMode) |
| 704 | continue; |
| 705 | int CurChar=toupperw(Mask[I]); |
| 706 | if (CurChar=='H') |
| 707 | Hours=true; |
| 708 | |
| 709 | if (Hours && CurChar=='M') |
| 710 | { |
| 711 | // Replace minutes with 'I'. We use 'M' both for months and minutes, |
| 712 | // so we treat as minutes only those 'M' which are found after hours. |
| 713 | Mask[I]='I'; |
| 714 | } |
| 715 | if (CurChar=='N') |
| 716 | { |
| 717 | uint Digits=GetDigits(ArcNumber); |
| 718 | uint NCount=0; |
| 719 | while (toupperw(Mask[I+NCount])=='N') |
| 720 | NCount++; |
| 721 | |
| 722 | // Here we ensure that we have enough 'N' characters to fit all digits |
| 723 | // of archive number. We'll replace them by actual number later |
| 724 | // in this function. |
| 725 | if (NCount<Digits) |
| 726 | { |
| 727 | wmemmove(Mask+I+Digits,Mask+I+NCount,wcslen(Mask+I+NCount)+1); |
| 728 | wmemset(Mask+I,'N',Digits); |
| 729 | } |
| 730 | I+=Max(Digits,NCount)-1; |
| 731 | ArcNumPresent=true; |
| 732 | continue; |
| 733 | } |
| 734 | } |
| 735 | |
| 736 | RarTime CurTime; |
| 737 | CurTime.SetCurrentTime(); |
| 738 | RarLocalTime rlt; |
| 739 | CurTime.GetLocal(&rlt); |
| 740 |
no test coverage detected