• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // ExtractCallbackSfx.h
2 
3 #ifndef __EXTRACT_CALLBACK_SFX_H
4 #define __EXTRACT_CALLBACK_SFX_H
5 
6 #include "resource.h"
7 
8 #include "../../../Windows/ResourceString.h"
9 
10 #include "../../Archive/IArchive.h"
11 
12 #include "../../Common/FileStreams.h"
13 #include "../../ICoder.h"
14 
15 #include "../../UI/FileManager/LangUtils.h"
16 
17 #ifndef _NO_PROGRESS
18 #include "../../UI/FileManager/ProgressDialog.h"
19 #endif
20 #include "../../UI/Common/ArchiveOpenCallback.h"
21 
22 class CExtractCallbackImp:
23   public IArchiveExtractCallback,
24   public IOpenCallbackUI,
25   public CMyUnknownImp
26 {
27 public:
28 
29   MY_UNKNOWN_IMP
30 
31   INTERFACE_IArchiveExtractCallback(;)
32   INTERFACE_IOpenCallbackUI(;)
33 
34 private:
35   CMyComPtr<IInArchive> _archiveHandler;
36   FString _directoryPath;
37   UString _filePath;
38   FString _diskFilePath;
39 
40   bool _extractMode;
41   struct CProcessedFileInfo
42   {
43     FILETIME MTime;
44     bool IsDir;
45     UInt32 Attributes;
46   } _processedFileInfo;
47 
48   COutFileStream *_outFileStreamSpec;
49   CMyComPtr<ISequentialOutStream> _outFileStream;
50 
51   UString _itemDefaultName;
52   FILETIME _defaultMTime;
53   UInt32 _defaultAttributes;
54 
55   void CreateComplexDirectory(const UStringVector &dirPathParts);
56 public:
57   #ifndef _NO_PROGRESS
58   CProgressDialog ProgressDialog;
59   #endif
60 
61   bool _isCorrupt;
62   UString _message;
63 
64   void Init(IInArchive *archiveHandler,
65     const FString &directoryPath,
66     const UString &itemDefaultName,
67     const FILETIME &defaultMTime,
68     UInt32 defaultAttributes);
69 
70   #ifndef _NO_PROGRESS
StartProgressDialog(const UString & title,NWindows::CThread & thread)71   HRESULT StartProgressDialog(const UString &title, NWindows::CThread &thread)
72   {
73     ProgressDialog.Create(title, thread, 0);
74     {
75       ProgressDialog.SetText(LangString(IDS_PROGRESS_EXTRACTING));
76     }
77 
78     ProgressDialog.Show(SW_SHOWNORMAL);
79     return S_OK;
80   }
~CExtractCallbackImp()81   virtual ~CExtractCallbackImp() { ProgressDialog.Destroy(); }
82   #endif
83 
84 };
85 
86 #endif
87