1 // Extract.h
2 
3 #ifndef __EXTRACT_H
4 #define __EXTRACT_H
5 
6 #include "../../../Windows/FileFind.h"
7 
8 #include "../../Archive/IArchive.h"
9 
10 #include "ArchiveExtractCallback.h"
11 #include "ArchiveOpenCallback.h"
12 #include "ExtractMode.h"
13 #include "Property.h"
14 
15 #include "../Common/LoadCodecs.h"
16 
17 struct CExtractOptionsBase
18 {
19   CBoolPair ElimDup;
20 
21   bool PathMode_Force;
22   bool OverwriteMode_Force;
23   NExtract::NPathMode::EEnum PathMode;
24   NExtract::NOverwriteMode::EEnum OverwriteMode;
25 
26   FString OutputDir;
27   CExtractNtOptions NtOptions;
28 
CExtractOptionsBaseCExtractOptionsBase29   CExtractOptionsBase():
30       PathMode_Force(false),
31       OverwriteMode_Force(false),
32       PathMode(NExtract::NPathMode::kFullPaths),
33       OverwriteMode(NExtract::NOverwriteMode::kAsk)
34       {}
35 };
36 
37 struct CExtractOptions: public CExtractOptionsBase
38 {
39   bool StdInMode;
40   bool StdOutMode;
41   bool YesToAll;
42   bool TestMode;
43 
44   // bool ShowDialog;
45   // bool PasswordEnabled;
46   // UString Password;
47   #ifndef _SFX
48   CObjectVector<CProperty> Properties;
49   #endif
50 
51   #ifdef EXTERNAL_CODECS
52   CCodecs *Codecs;
53   #endif
54 
CExtractOptionsCExtractOptions55   CExtractOptions():
56       TestMode(false),
57       StdInMode(false),
58       StdOutMode(false),
59       YesToAll(false)
60       {}
61 };
62 
63 struct CDecompressStat
64 {
65   UInt64 NumArchives;
66   UInt64 UnpackSize;
67   UInt64 AltStreams_UnpackSize;
68   UInt64 PackSize;
69   UInt64 NumFolders;
70   UInt64 NumFiles;
71   UInt64 NumAltStreams;
72 
ClearCDecompressStat73   void Clear()
74   {
75     NumArchives = UnpackSize = AltStreams_UnpackSize = PackSize = NumFolders = NumFiles = NumAltStreams = 0;
76   }
77 };
78 
79 HRESULT Extract(
80     CCodecs *codecs,
81     const CObjectVector<COpenType> &types,
82     const CIntVector &excludedFormats,
83     UStringVector &archivePaths, UStringVector &archivePathsFull,
84     const NWildcard::CCensorNode &wildcardCensor,
85     const CExtractOptions &options,
86     IOpenCallbackUI *openCallback,
87     IExtractCallbackUI *extractCallback,
88     #ifndef _SFX
89     IHashCalc *hash,
90     #endif
91     UString &errorMessage,
92     CDecompressStat &stat);
93 
94 #endif
95