diff options
Diffstat (limited to 'CPP/7zip/UI/Far/PluginRead.cpp')
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/PluginRead.cpp | 75 |
1 files changed, 39 insertions, 36 deletions
diff --git a/CPP/7zip/UI/Far/PluginRead.cpp b/CPP/7zip/UI/Far/PluginRead.cpp index a4450064..6e77a9d5 100755..100644 --- a/CPP/7zip/UI/Far/PluginRead.cpp +++ b/CPP/7zip/UI/Far/PluginRead.cpp @@ -6,19 +6,20 @@ #include "Messages.h" -#include "Common/StringConvert.h" +#include "../../../Common/StringConvert.h" -#include "Windows/FileName.h" -#include "Windows/FileFind.h" -#include "Windows/FileDir.h" -#include "Windows/Defs.h" +#include "../../../Windows/FileName.h" +#include "../../../Windows/FileFind.h" +#include "../../../Windows/FileDir.h" #include "../Common/ZipRegistry.h" #include "ExtractEngine.h" -using namespace NFar; using namespace NWindows; +using namespace NFile; +using namespace NDir; +using namespace NFar; static const char *kHelpTopicExtrFromSevenZip = "Extract"; @@ -28,8 +29,8 @@ static const char *kExractPathHistoryName = "7-ZipExtractPath"; HRESULT CPlugin::ExtractFiles( bool decompressAllItems, - const UINT32 *indices, - UINT32 numIndices, + const UInt32 *indices, + UInt32 numIndices, bool silent, NExtract::NPathMode::EEnum pathMode, NExtract::NOverwriteMode::EEnum overwriteMode, @@ -70,7 +71,10 @@ HRESULT CPlugin::ExtractFiles( CMyComPtr<IArchiveFolder> archiveFolder; _folder.QueryInterface(IID_IArchiveFolder, &archiveFolder); - return archiveFolder->Extract(indices, numIndices, pathMode, overwriteMode, + return archiveFolder->Extract(indices, numIndices, + BoolToInt(true), // includeAltStreams + BoolToInt(false), // replaceAltStreamChars + pathMode, overwriteMode, destPath, BoolToInt(false), extractCallback); } } @@ -93,14 +97,14 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa AString destPath = destPathLoc; UString destPathU = GetUnicodeString(destPath, CP_OEMCP); - NFile::NName::NormalizeDirPathPrefix(destPathU); + NName::NormalizeDirPathPrefix(destPathU); destPath = UnicodeStringToMultiByte(destPathU, CP_OEMCP); bool extractSelectedFiles = true; NExtract::CInfo extractionInfo; - extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames; - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt; + extractionInfo.PathMode = NExtract::NPathMode::kCurPaths; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kOverwrite; bool silent = (opMode & OPM_SILENT) != 0; bool decompressAllItems = false; @@ -134,30 +138,30 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa { DI_SINGLEBOX, 4, 5, kXMid - 2, 5 + 4, false, false, 0, false, NMessageID::kExtractPathMode, NULL, NULL }, { DI_RADIOBUTTON, 6, 6, 0, 0, false, - extractionInfo.PathMode == NExtract::NPathMode::kFullPathnames, + extractionInfo.PathMode == NExtract::NPathMode::kFullPaths, DIF_GROUP, false, NMessageID::kExtractPathFull, NULL, NULL }, { DI_RADIOBUTTON, 6, 7, 0, 0, false, - extractionInfo.PathMode == NExtract::NPathMode::kCurrentPathnames, + extractionInfo.PathMode == NExtract::NPathMode::kCurPaths, 0, false, NMessageID::kExtractPathCurrent, NULL, NULL }, { DI_RADIOBUTTON, 6, 8, 0, 0, false, - extractionInfo.PathMode == NExtract::NPathMode::kNoPathnames, + extractionInfo.PathMode == NExtract::NPathMode::kNoPaths, false, 0, NMessageID::kExtractPathNo, NULL, NULL }, { DI_SINGLEBOX, kXMid, 5, kXSize - 6, 5 + kNumOverwriteOptions, false, false, 0, false, NMessageID::kExtractOwerwriteMode, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAskBefore, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAsk, DIF_GROUP, false, NMessageID::kExtractOwerwriteAsk, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kWithoutPrompt, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kOverwrite, 0, false, NMessageID::kExtractOwerwritePrompt, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkipExisting, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkip, 0, false, NMessageID::kExtractOwerwriteSkip, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 9, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRename, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kRename, 0, false, NMessageID::kExtractOwerwriteAutoRename, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kRenameExisting, 0, false, NMessageID::kExtractOwerwriteAutoRenameExisting, NULL, NULL }, { DI_SINGLEBOX, 4, 10, kXMid- 2, 10 + 3, false, false, 0, false, NMessageID::kExtractFilesMode, NULL, NULL }, @@ -174,7 +178,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kExtractCancel, NULL, NULL } }; - const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); + const int kNumDialogItems = ARRAY_SIZE(initItems); const int kOkButtonIndex = kNumDialogItems - 2; const int kPasswordIndex = kNumDialogItems - 4; @@ -195,9 +199,9 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa destPathU = L"\\"; #else FString destPathF = us2fs(destPathU); - if (!NFile::NDirectory::MyGetCurrentDirectory(destPathF)) + if (!GetCurrentDir(destPathF)) throw 318016; - NFile::NName::NormalizeDirPathPrefix(destPathF); + NName::NormalizeDirPathPrefix(destPathF); destPathU = fs2us(destPathF); #endif break; @@ -211,24 +215,24 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa } if (dialogItems[kPathModeRadioIndex].Selected) - extractionInfo.PathMode = NExtract::NPathMode::kFullPathnames; + extractionInfo.PathMode = NExtract::NPathMode::kFullPaths; else if (dialogItems[kPathModeRadioIndex + 1].Selected) - extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames; + extractionInfo.PathMode = NExtract::NPathMode::kCurPaths; else if (dialogItems[kPathModeRadioIndex + 2].Selected) - extractionInfo.PathMode = NExtract::NPathMode::kNoPathnames; + extractionInfo.PathMode = NExtract::NPathMode::kNoPaths; else throw 31806; if (dialogItems[kOverwriteModeRadioIndex].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAskBefore; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAsk; else if (dialogItems[kOverwriteModeRadioIndex + 1].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kOverwrite; else if (dialogItems[kOverwriteModeRadioIndex + 2].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkipExisting; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkip; else if (dialogItems[kOverwriteModeRadioIndex + 3].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRename; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kRename; else if (dialogItems[kOverwriteModeRadioIndex + 4].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRenameExisting; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kRenameExisting; else throw 31806; @@ -253,19 +257,18 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa passwordIsDefined = !password.IsEmpty(); } - NFile::NDirectory::CreateComplexDirectory(us2fs(destPathU)); + CreateComplexDir(us2fs(destPathU)); /* vector<int> realIndices; if (!decompressAllItems) GetRealIndexes(panelItems, itemsNumber, realIndices); */ - CRecordVector<UINT32> indices; - indices.Reserve(itemsNumber); + CObjArray<UInt32> indices(itemsNumber); for (int i = 0; i < itemsNumber; i++) - indices.Add((UINT32)panelItems[i].UserData); + indices[i] = (UInt32)panelItems[i].UserData; - HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber, + HRESULT result = ExtractFiles(decompressAllItems, indices, itemsNumber, !showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode, destPathU, passwordIsDefined, password); |