1370b324cSopenharmony_ci// ExtractCallbackSfx.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_EXTRACT_CALLBACK_SFX_H
4370b324cSopenharmony_ci#define ZIP7_INC_EXTRACT_CALLBACK_SFX_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "resource.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ci#include "../../../Windows/ResourceString.h"
9370b324cSopenharmony_ci
10370b324cSopenharmony_ci#include "../../Archive/IArchive.h"
11370b324cSopenharmony_ci
12370b324cSopenharmony_ci#include "../../Common/FileStreams.h"
13370b324cSopenharmony_ci#include "../../ICoder.h"
14370b324cSopenharmony_ci
15370b324cSopenharmony_ci#include "../../UI/FileManager/LangUtils.h"
16370b324cSopenharmony_ci
17370b324cSopenharmony_ci#ifndef _NO_PROGRESS
18370b324cSopenharmony_ci#include "../../UI/FileManager/ProgressDialog.h"
19370b324cSopenharmony_ci#endif
20370b324cSopenharmony_ci#include "../../UI/Common/ArchiveOpenCallback.h"
21370b324cSopenharmony_ci
22370b324cSopenharmony_ciclass CExtractCallbackImp Z7_final:
23370b324cSopenharmony_ci  public IArchiveExtractCallback,
24370b324cSopenharmony_ci  public IOpenCallbackUI,
25370b324cSopenharmony_ci  public CMyUnknownImp
26370b324cSopenharmony_ci{
27370b324cSopenharmony_ci  Z7_COM_UNKNOWN_IMP_0
28370b324cSopenharmony_ci  Z7_IFACE_COM7_IMP(IProgress)
29370b324cSopenharmony_ci  Z7_IFACE_COM7_IMP(IArchiveExtractCallback)
30370b324cSopenharmony_ci  Z7_IFACE_IMP(IOpenCallbackUI)
31370b324cSopenharmony_ci
32370b324cSopenharmony_ci  CMyComPtr<IInArchive> _archiveHandler;
33370b324cSopenharmony_ci  FString _directoryPath;
34370b324cSopenharmony_ci  UString _filePath;
35370b324cSopenharmony_ci  FString _diskFilePath;
36370b324cSopenharmony_ci
37370b324cSopenharmony_ci  bool _extractMode;
38370b324cSopenharmony_ci  struct CProcessedFileInfo
39370b324cSopenharmony_ci  {
40370b324cSopenharmony_ci    FILETIME MTime;
41370b324cSopenharmony_ci    bool IsDir;
42370b324cSopenharmony_ci    UInt32 Attributes;
43370b324cSopenharmony_ci  } _processedFileInfo;
44370b324cSopenharmony_ci
45370b324cSopenharmony_ci  COutFileStream *_outFileStreamSpec;
46370b324cSopenharmony_ci  CMyComPtr<ISequentialOutStream> _outFileStream;
47370b324cSopenharmony_ci
48370b324cSopenharmony_ci  UString _itemDefaultName;
49370b324cSopenharmony_ci  FILETIME _defaultMTime;
50370b324cSopenharmony_ci  UInt32 _defaultAttributes;
51370b324cSopenharmony_ci
52370b324cSopenharmony_ci  void CreateComplexDirectory(const UStringVector &dirPathParts);
53370b324cSopenharmony_cipublic:
54370b324cSopenharmony_ci  #ifndef _NO_PROGRESS
55370b324cSopenharmony_ci  CProgressDialog ProgressDialog;
56370b324cSopenharmony_ci  #endif
57370b324cSopenharmony_ci
58370b324cSopenharmony_ci  bool _isCorrupt;
59370b324cSopenharmony_ci  UString _message;
60370b324cSopenharmony_ci
61370b324cSopenharmony_ci  void Init(IInArchive *archiveHandler,
62370b324cSopenharmony_ci    const FString &directoryPath,
63370b324cSopenharmony_ci    const UString &itemDefaultName,
64370b324cSopenharmony_ci    const FILETIME &defaultMTime,
65370b324cSopenharmony_ci    UInt32 defaultAttributes);
66370b324cSopenharmony_ci
67370b324cSopenharmony_ci  #ifndef _NO_PROGRESS
68370b324cSopenharmony_ci  HRESULT StartProgressDialog(const UString &title, NWindows::CThread &thread)
69370b324cSopenharmony_ci  {
70370b324cSopenharmony_ci    ProgressDialog.Create(title, thread, NULL);
71370b324cSopenharmony_ci    {
72370b324cSopenharmony_ci      ProgressDialog.SetText(LangString(IDS_PROGRESS_EXTRACTING));
73370b324cSopenharmony_ci    }
74370b324cSopenharmony_ci
75370b324cSopenharmony_ci    ProgressDialog.Show(SW_SHOWNORMAL);
76370b324cSopenharmony_ci    return S_OK;
77370b324cSopenharmony_ci  }
78370b324cSopenharmony_ci  ~CExtractCallbackImp() { ProgressDialog.Destroy(); }
79370b324cSopenharmony_ci  #endif
80370b324cSopenharmony_ci
81370b324cSopenharmony_ci};
82370b324cSopenharmony_ci
83370b324cSopenharmony_ci#endif
84