1 // ExtractCallbackConsole.h
2 
3 #ifndef __EXTRACTCALLBACKCONSOLE_H
4 #define __EXTRACTCALLBACKCONSOLE_H
5 
6 #include "Common/MyString.h"
7 #include "Common/StdOutStream.h"
8 #include "../../Common/FileStreams.h"
9 #include "../../IPassword.h"
10 #include "../../Archive/IArchive.h"
11 #include "../Common/ArchiveExtractCallback.h"
12 
13 class CExtractCallbackConsole:
14   public IExtractCallbackUI,
15   #ifndef _NO_CRYPTO
16   public ICryptoGetTextPassword,
17   #endif
18   public CMyUnknownImp
19 {
20 public:
21   MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
22   #ifndef _NO_CRYPTO
23   MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
24   #endif
25   MY_QUERYINTERFACE_END
26   MY_ADDREF_RELEASE
27 
28   STDMETHOD(SetTotal)(UInt64 total);
29   STDMETHOD(SetCompleted)(const UInt64 *completeValue);
30 
31   // IFolderArchiveExtractCallback
32   STDMETHOD(AskOverwrite)(
33       const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
34       const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
35       Int32 *answer);
36   STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
37 
38   STDMETHOD(MessageError)(const wchar_t *message);
39   STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
40 
41   HRESULT BeforeOpen(const wchar_t *name);
42   HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
43   HRESULT ThereAreNoFiles();
44   HRESULT ExtractResult(HRESULT result);
45 
46 
47   #ifndef _NO_CRYPTO
48   HRESULT SetPassword(const UString &password);
49   STDMETHOD(CryptoGetTextPassword)(BSTR *password);
50 
51   bool PasswordIsDefined;
52   UString Password;
53 
54   #endif
55 
56   UInt64 NumArchives;
57   UInt64 NumArchiveErrors;
58   UInt64 NumFileErrors;
59   UInt64 NumFileErrorsInCurrentArchive;
60 
61   CStdOutStream *OutStream;
62 
Init()63   void Init()
64   {
65     NumArchives = 0;
66     NumArchiveErrors = 0;
67     NumFileErrors = 0;
68     NumFileErrorsInCurrentArchive = 0;
69   }
70 
71 };
72 
73 #endif
74