1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// ArchiveExtractCallback.h
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __ARCHIVE_EXTRACT_CALLBACK_H
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __ARCHIVE_EXTRACT_CALLBACK_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "Common/MyCom.h"
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "Common/Wildcard.h"
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../IPassword.h"
10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Common/FileStreams.h"
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Common/ProgressUtils.h"
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Archive/IArchive.h"
15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Archive/Common/OutStreamWithCRC.h"
17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "ExtractMode.h"
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "IFileExtractCallback.h"
20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "OpenArchive.h"
21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
22baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CArchiveExtractCallback:
23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public IArchiveExtractCallback,
24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  // public IArchiveVolumeExtractCallback,
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICryptoGetTextPassword,
26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICompressProgressInfo,
27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public CMyUnknownImp
28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  const CArc *_arc;
30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  const NWildcard::CCensorNode *_wildcardCensor;
31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<IFolderArchiveExtractCallback> _extractCallback2;
32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<ICompressProgressInfo> _compressProgress;
33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<ICryptoGetTextPassword> _cryptoGetTextPassword;
34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UString _directoryPath;
35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  NExtract::NPathMode::EEnum _pathMode;
36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  NExtract::NOverwriteMode::EEnum _overwriteMode;
37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UString _diskFilePath;
39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UString _filePath;
40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 _position;
41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _isSplit;
42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _extractMode;
44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool WriteCTime;
46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool WriteATime;
47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool WriteMTime;
48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _encrypted;
50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  struct CProcessedFileInfo
52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  {
53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    FILETIME CTime;
54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    FILETIME ATime;
55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    FILETIME MTime;
56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    UInt32 Attrib;
57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    bool CTimeDefined;
59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    bool ATimeDefined;
60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    bool MTimeDefined;
61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    bool AttribDefined;
62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    bool IsDir;
64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  } _fi;
65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 _index;
67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 _curSize;
68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _curSizeDefined;
69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  COutFileStream *_outFileStreamSpec;
70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<ISequentialOutStream> _outFileStream;
71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  COutStreamWithCRC *_crcStreamSpec;
73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<ISequentialOutStream> _crcStream;
74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UStringVector _removePathParts;
76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _stdOutMode;
78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _testMode;
79baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _crcMode;
80baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _multiArchives;
81baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
82baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<ICompressProgressInfo> _localProgress;
83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 _packTotal;
84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 _unpTotal;
85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
86baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void CreateComplexDirectory(const UStringVector &dirPathParts, UString &fullPath);
87baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined);
88baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  HRESULT GetUnpackSize();
89baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
90baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic:
91baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
92baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CLocalProgress *LocalProgressSpec;
93baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
94baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 NumFolders;
95baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 NumFiles;
96baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 UnpackSize;
97baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 CrcSum;
98baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
99baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  MY_UNKNOWN_IMP2(ICryptoGetTextPassword, ICompressProgressInfo)
100baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  // COM_INTERFACE_ENTRY(IArchiveVolumeExtractCallback)
101baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
102baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  INTERFACE_IArchiveExtractCallback(;)
103baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
104baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
105baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
106baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  // IArchiveVolumeExtractCallback
107baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  // STDMETHOD(GetInStream)(const wchar_t *name, ISequentialInStream **inStream);
108baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
109baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(CryptoGetTextPassword)(BSTR *password);
110baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
111baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CArchiveExtractCallback():
112baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      WriteCTime(true),
113baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      WriteATime(true),
114baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      WriteMTime(true),
115baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      _multiArchives(false)
116baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  {
117baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    LocalProgressSpec = new CLocalProgress();
118baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    _localProgress = LocalProgressSpec;
119baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  }
120baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
121baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void InitForMulti(bool multiArchives,
122baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      NExtract::NPathMode::EEnum pathMode,
123baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      NExtract::NOverwriteMode::EEnum overwriteMode)
124baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  {
125baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    _multiArchives = multiArchives;
126baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    _pathMode = pathMode;
127baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    _overwriteMode = overwriteMode;
128baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    NumFolders = NumFiles = UnpackSize = 0;
129baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    CrcSum = 0;
130baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  }
131baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
132baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void Init(
133baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      const NWildcard::CCensorNode *wildcardCensor,
134baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      const CArc *arc,
135baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      IFolderArchiveExtractCallback *extractCallback2,
136baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      bool stdOutMode, bool testMode, bool crcMode,
137baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      const UString &directoryPath,
138baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      const UStringVector &removePathParts,
139baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      UInt64 packSize);
140baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
141baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
142baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
143baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
144