Add other methods to compression dialog

Signed-off-by: SCell555 <kubci.rusnk645@gmail.com>
Co-Authored-By: Tino Reichardt <milky-7zip@mcmilk.de>
This commit is contained in:
Tino Reichardt
2023-01-15 12:42:06 +01:00
parent 3c65c6c314
commit cf29d0c1ba
12 changed files with 407 additions and 59 deletions

View File

@@ -415,6 +415,7 @@ HRESULT CCodecs::LoadFormats()
Func_GetHandlerProperty getProp = NULL;
MY_GET_FUNC_LOC (getProp2, Func_GetHandlerProperty2, lib.GetProc("GetHandlerProperty2"));
MY_GET_FUNC_LOC (getIsArc, Func_GetIsArc, lib.GetProc("GetIsArc"));
MY_GET_FUNC_LOC (getFormatLevelMask, Func_GetFormatLevelMask, lib.GetProc("GetFormatLevelMask"));
UInt32 numFormats = 1;
@@ -473,7 +474,7 @@ HRESULT CCodecs::LoadFormats()
item.Flags |= kArcFlagsPars[j + 1];
}
}
{
bool defined = false;
RINOK(GetProp_UInt32(getProp, getProp2, i, NArchive::NHandlerPropID::kTimeFlags, item.TimeFlags, defined));
@@ -498,6 +499,9 @@ HRESULT CCodecs::LoadFormats()
if (getIsArc)
getIsArc(i, &item.IsArcFunc);
if (getFormatLevelMask)
getFormatLevelMask(i, &item.LevelsMask);
Formats.Add(item);
}
return S_OK;

View File

@@ -120,6 +120,7 @@ struct CArcInfoEx
int LibIndex;
UInt32 FormatIndex;
CLSID ClassID;
UInt32 LevelsMask;
#endif
int Compare(const CArcInfoEx &a) const
@@ -224,6 +225,7 @@ struct CArcInfoEx
#endif
#ifdef EXTERNAL_CODECS
, LibIndex(-1)
, LevelsMask(0xFFFFFFFF)
#endif
{}
};

View File

@@ -581,7 +581,7 @@ static HRESULT Compress(
UInt32 value;
RINOK(outArchive->GetFileTimeType(&value));
// we support any future fileType here.
fileTimeType = (NFileTimeType::EEnum)value;
@@ -839,6 +839,7 @@ static HRESULT Compress(
}
else
{
single:
outStreamSpec = new COutFileStream;
outSeekStream = outStreamSpec;
outStream = outSeekStream;
@@ -881,6 +882,36 @@ static HRESULT Compress(
if (arc && arc->GetGlobalOffset() > 0)
return E_NOTIMPL;
CMyComPtr<IMultiVolumeOutArchive> multiVolArch;
outArchive->QueryInterface(IID_IMultiVolumeOutArchive, (void**)&multiVolArch);
if (multiVolArch)
{
CPropVariant prefix, postfix, name;
name = archivePath.Name;
BOOL numberAfterExt = FALSE;
UInt32 numberCount = 2;
RINOK(multiVolArch->GetMultiArchiveNameFmt(&name, &prefix, &postfix, &numberAfterExt, &numberCount));
if (prefix.vt != VT_EMPTY && prefix.vt != VT_BSTR)
return E_FAIL;
if (postfix.vt != VT_EMPTY && postfix.vt != VT_BSTR)
return E_FAIL;
updateCallbackSpec->VolumesSizes = options.VolumesSizes;
if (name.vt == VT_BSTR)
updateCallbackSpec->VolName = archivePath.Prefix + name.bstrVal;
else
updateCallbackSpec->VolName = archivePath.Prefix + archivePath.Name;
updateCallbackSpec->VolNumberAfterExt = numberAfterExt != FALSE;
if (prefix.vt == VT_BSTR)
updateCallbackSpec->VolPrefix.SetFromBstr(prefix.bstrVal);
if (postfix.vt == VT_BSTR)
updateCallbackSpec->VolPostfix.SetFromBstr(postfix.bstrVal);
if (!archivePath.VolExtension.IsEmpty())
updateCallbackSpec->VolExt = UString('.') + archivePath.VolExtension;
updateCallbackSpec->DigitCount = numberCount;
const_cast<CRecordVector<UInt64>&>(options.VolumesSizes).Clear();
goto single;
}
volStreamSpec = new COutMultiVolStream;
outSeekStream = volStreamSpec;
outStream = outSeekStream;
@@ -889,13 +920,6 @@ static HRESULT Compress(
volStreamSpec->Prefix += '.';
volStreamSpec->TempFiles = &tempFiles;
volStreamSpec->Init();
/*
updateCallbackSpec->VolumesSizes = volumesSizes;
updateCallbackSpec->VolName = archivePath.Prefix + archivePath.Name;
if (!archivePath.VolExtension.IsEmpty())
updateCallbackSpec->VolExt = UString('.') + archivePath.VolExtension;
*/
}
if (options.SfxMode)
@@ -1433,7 +1457,7 @@ HRESULT UpdateArchive(
dirItems.ScanAltStreams = options.AltStreams.Val;
dirItems.ExcludeDirItems = censor.ExcludeDirItems;
dirItems.ExcludeFileItems = censor.ExcludeFileItems;
dirItems.ShareForWrite = options.OpenShareForWrite;
#ifndef _WIN32

View File

@@ -79,7 +79,7 @@ CArchiveUpdateCallback::CArchiveUpdateCallback():
StoreNtSecurity(false),
StoreHardLinks(false),
StoreSymLinks(false),
#ifndef _WIN32
StoreOwnerId(false),
StoreOwnerName(false),
@@ -92,7 +92,9 @@ CArchiveUpdateCallback::CArchiveUpdateCallback():
Need_LatestMTime(false),
LatestMTime_Defined(false),
ProcessedItemsStatuses(NULL)
ProcessedItemsStatuses(NULL),
VolNumberAfterExt(false),
DigitCount(2)
{
#ifdef _USE_SECURITY_CODE
_saclEnabled = InitLocalPrivileges();
@@ -159,7 +161,6 @@ STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 index,
COM_TRY_END
}
STDMETHODIMP CArchiveUpdateCallback::GetRootProp(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
@@ -482,7 +483,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
#if defined(_WIN32)
case kpidIsAltStream: prop = di.IsAltStream; break;
// case kpidShortName: prop = di.ShortName; break;
#else
#else
case kpidDeviceMajor:
/*
@@ -511,9 +512,9 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
if (di.OwnerGroupIndex >= 0)
prop = DirItems->OwnerGroupMap.Strings[(unsigned)di.OwnerGroupIndex];
break;
#endif
#endif
}
}
}
prop.Detach(value);
return S_OK;
COM_TRY_END
@@ -907,12 +908,31 @@ STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOu
char temp[16];
ConvertUInt32ToString(index + 1, temp);
FString res (temp);
while (res.Len() < 2)
while (res.Len() < DigitCount)
res.InsertAtFront(FTEXT('0'));
FString fileName = VolName;
fileName += '.';
fileName += res;
fileName += VolExt;
if (VolNumberAfterExt)
{
if (!VolPrefix.IsEmpty())
fileName += VolPrefix;
fileName += VolExt;
if (!VolPostfix.IsEmpty())
fileName += VolPostfix;
else
fileName += '.';
fileName += res;
}
else
{
if (!VolPrefix.IsEmpty())
fileName += VolPrefix;
else
fileName += '.';
fileName += res;
if (!VolPostfix.IsEmpty())
fileName += VolPostfix;
fileName += VolExt;
}
COutFileStream *streamSpec = new COutFileStream;
CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
if (!streamSpec->Create(fileName, false))

View File

@@ -135,6 +135,10 @@ public:
FString VolName;
FString VolExt;
UString ArcFileName; // without path prefix
FString VolPrefix;
FString VolPostfix;
bool VolNumberAfterExt;
UInt32 DigitCount;
IUpdateCallbackUI *Callback;