|
1 // OpenArchive.h |
|
2 |
|
3 #ifndef __OPENARCHIVE_H |
|
4 #define __OPENARCHIVE_H |
|
5 |
|
6 #include "Common/String.h" |
|
7 #include "Windows/FileFind.h" |
|
8 |
|
9 #include "../../Archive/IArchive.h" |
|
10 #include "ArchiverInfo.h" |
|
11 #include "ArchiveOpenCallback.h" |
|
12 |
|
13 #ifndef EXCLUDE_COM |
|
14 #include "Windows/DLL.h" |
|
15 #endif |
|
16 |
|
17 HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, UString &result); |
|
18 HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &defaultName, UString &result); |
|
19 HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index, |
|
20 const FILETIME &defaultFileTime, FILETIME &fileTime); |
|
21 HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result); |
|
22 HRESULT IsArchiveItemAnti(IInArchive *archive, UInt32 index, bool &result); |
|
23 |
|
24 struct ISetSubArchiveName |
|
25 { |
|
26 virtual void SetSubArchiveName(const wchar_t *name) = 0; |
|
27 }; |
|
28 |
|
29 HRESULT OpenArchive( |
|
30 IInStream *inStream, |
|
31 const UString &fileName, |
|
32 #ifndef EXCLUDE_COM |
|
33 HMODULE *module, |
|
34 #endif |
|
35 IInArchive **archiveResult, |
|
36 CArchiverInfo &archiverInfoResult, |
|
37 UString &defaultItemName, |
|
38 IArchiveOpenCallback *openArchiveCallback); |
|
39 |
|
40 HRESULT OpenArchive(const UString &filePath, |
|
41 #ifndef EXCLUDE_COM |
|
42 HMODULE *module, |
|
43 #endif |
|
44 IInArchive **archive, |
|
45 CArchiverInfo &archiverInfo, |
|
46 UString &defaultItemName, |
|
47 IArchiveOpenCallback *openArchiveCallback); |
|
48 |
|
49 HRESULT OpenArchive(const UString &filePath, |
|
50 #ifndef EXCLUDE_COM |
|
51 HMODULE *module0, |
|
52 HMODULE *module1, |
|
53 #endif |
|
54 IInArchive **archive0, |
|
55 IInArchive **archive1, |
|
56 CArchiverInfo &archiverInfo0, |
|
57 CArchiverInfo &archiverInfo1, |
|
58 UString &defaultItemName0, |
|
59 UString &defaultItemName1, |
|
60 IArchiveOpenCallback *openArchiveCallback); |
|
61 |
|
62 |
|
63 HRESULT ReOpenArchive(IInArchive *archive, |
|
64 const UString &fileName); |
|
65 |
|
66 HRESULT MyOpenArchive(const UString &archiveName, |
|
67 #ifndef EXCLUDE_COM |
|
68 HMODULE *module, |
|
69 #endif |
|
70 IInArchive **archive, |
|
71 UString &defaultItemName, |
|
72 IOpenCallbackUI *openCallbackUI); |
|
73 |
|
74 HRESULT MyOpenArchive(const UString &archiveName, |
|
75 #ifndef EXCLUDE_COM |
|
76 HMODULE *module0, |
|
77 HMODULE *module1, |
|
78 #endif |
|
79 IInArchive **archive0, |
|
80 IInArchive **archive1, |
|
81 UString &defaultItemName0, |
|
82 UString &defaultItemName1, |
|
83 UStringVector &volumePaths, |
|
84 IOpenCallbackUI *openCallbackUI); |
|
85 |
|
86 struct CArchiveLink |
|
87 { |
|
88 #ifndef EXCLUDE_COM |
|
89 NWindows::NDLL::CLibrary Library0; |
|
90 NWindows::NDLL::CLibrary Library1; |
|
91 #endif |
|
92 CMyComPtr<IInArchive> Archive0; |
|
93 CMyComPtr<IInArchive> Archive1; |
|
94 UString DefaultItemName0; |
|
95 UString DefaultItemName1; |
|
96 |
|
97 CArchiverInfo ArchiverInfo0; |
|
98 CArchiverInfo ArchiverInfo1; |
|
99 |
|
100 UStringVector VolumePaths; |
|
101 |
|
102 int GetNumLevels() const |
|
103 { |
|
104 int result = 0; |
|
105 if (Archive0) |
|
106 { |
|
107 result++; |
|
108 if (Archive1) |
|
109 result++; |
|
110 } |
|
111 return result; |
|
112 } |
|
113 |
|
114 |
|
115 IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; } |
|
116 UString GetDefaultItemName() { return Archive1 != 0 ? DefaultItemName1: DefaultItemName0; } |
|
117 const CArchiverInfo &GetArchiverInfo() { return Archive1 != 0 ? ArchiverInfo1: ArchiverInfo0; } |
|
118 HRESULT Close(); |
|
119 void Release(); |
|
120 }; |
|
121 |
|
122 HRESULT OpenArchive(const UString &archiveName, |
|
123 CArchiveLink &archiveLink, |
|
124 IArchiveOpenCallback *openCallback); |
|
125 |
|
126 HRESULT MyOpenArchive(const UString &archiveName, |
|
127 CArchiveLink &archiveLink, |
|
128 IOpenCallbackUI *openCallbackUI); |
|
129 |
|
130 HRESULT ReOpenArchive(CArchiveLink &archiveLink, |
|
131 const UString &fileName); |
|
132 |
|
133 #endif |
|
134 |