Home | History | Annotate | Download | only in Console
      1 // ExtractCallbackConsole.h
      2 
      3 #ifndef __EXTRACTCALLBACKCONSOLE_H
      4 #define __EXTRACTCALLBACKCONSOLE_H
      5 
      6 #include "../../../Common/MyString.h"
      7 #include "../../../Common/StdOutStream.h"
      8 
      9 #include "../../Common/FileStreams.h"
     10 
     11 #include "../../IPassword.h"
     12 
     13 #include "../../Archive/IArchive.h"
     14 
     15 #include "../Common/ArchiveExtractCallback.h"
     16 
     17 class CExtractCallbackConsole:
     18   public IExtractCallbackUI,
     19   #ifndef _NO_CRYPTO
     20   public ICryptoGetTextPassword,
     21   #endif
     22   public CMyUnknownImp
     23 {
     24 public:
     25   MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
     26   #ifndef _NO_CRYPTO
     27   MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
     28   #endif
     29   MY_QUERYINTERFACE_END
     30   MY_ADDREF_RELEASE
     31 
     32   STDMETHOD(SetTotal)(UInt64 total);
     33   STDMETHOD(SetCompleted)(const UInt64 *completeValue);
     34 
     35   // IFolderArchiveExtractCallback
     36   STDMETHOD(AskOverwrite)(
     37       const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
     38       const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
     39       Int32 *answer);
     40   STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
     41 
     42   STDMETHOD(MessageError)(const wchar_t *message);
     43   STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
     44 
     45   HRESULT BeforeOpen(const wchar_t *name);
     46   HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
     47   HRESULT SetError(int level, const wchar_t *name,
     48         UInt32 errorFlags, const wchar_t *errors,
     49         UInt32 warningFlags, const wchar_t *warnings);
     50 
     51   HRESULT ThereAreNoFiles();
     52   HRESULT ExtractResult(HRESULT result);
     53   HRESULT OpenTypeWarning(const wchar_t *name, const wchar_t *okType, const wchar_t *errorType);
     54 
     55 
     56   #ifndef _NO_CRYPTO
     57   HRESULT SetPassword(const UString &password);
     58   STDMETHOD(CryptoGetTextPassword)(BSTR *password);
     59 
     60   bool PasswordIsDefined;
     61   UString Password;
     62 
     63   #endif
     64 
     65   UInt64 NumTryArcs;
     66   bool ThereIsErrorInCurrent;
     67   bool ThereIsWarningInCurrent;
     68 
     69   UInt64 NumCantOpenArcs;
     70   UInt64 NumOkArcs;
     71   UInt64 NumArcsWithError;
     72   UInt64 NumArcsWithWarnings;
     73 
     74   UInt64 NumProblemArcsLevs;
     75   UInt64 NumOpenArcErrors;
     76   UInt64 NumOpenArcWarnings;
     77 
     78   UInt64 NumFileErrors;
     79   UInt64 NumFileErrorsInCurrent;
     80 
     81   CStdOutStream *OutStream;
     82 
     83   void Init()
     84   {
     85     NumTryArcs = 0;
     86     NumOkArcs = 0;
     87     NumCantOpenArcs = 0;
     88     NumArcsWithError = 0;
     89     NumArcsWithWarnings = 0;
     90 
     91     NumOpenArcErrors = 0;
     92     NumOpenArcWarnings = 0;
     93     NumFileErrors = 0;
     94     NumFileErrorsInCurrent = 0;
     95   }
     96 
     97 };
     98 
     99 #endif
    100