• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // OpenArchive.h
2 
3 #ifndef __OPEN_ARCHIVE_H
4 #define __OPEN_ARCHIVE_H
5 
6 #include "Common/MyString.h"
7 
8 #include "Windows/FileFind.h"
9 
10 #include "../../Archive/IArchive.h"
11 
12 #include "ArchiveOpenCallback.h"
13 #include "LoadCodecs.h"
14 
15 HRESULT GetArchiveItemBoolProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result);
16 HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result);
17 
18 struct CArc
19 {
20   CMyComPtr<IInArchive> Archive;
21   UString Path;
22   UString DefaultName;
23   int FormatIndex;
24   int SubfileIndex;
25   FILETIME MTime;
26   bool MTimeDefined;
27   UString ErrorMessage;
28 
CArcCArc29   CArc(): MTimeDefined(false) {}
30 
31   HRESULT GetItemPath(UInt32 index, UString &result) const;
32   HRESULT GetItemMTime(UInt32 index, FILETIME &ft, bool &defined) const;
IsItemAntiCArc33   HRESULT IsItemAnti(UInt32 index, bool &result) const
34     { return GetArchiveItemBoolProp(Archive, index, kpidIsAnti, result); }
35 
36   HRESULT OpenStream(
37     CCodecs *codecs,
38     int formatIndex,
39     IInStream *stream,
40     ISequentialInStream *seqStream,
41     IArchiveOpenCallback *callback);
42 
43   HRESULT OpenStreamOrFile(
44     CCodecs *codecs,
45     int formatIndex,
46     bool stdInMode,
47     IInStream *stream,
48     IArchiveOpenCallback *callback);
49 };
50 
51 struct CArchiveLink
52 {
53   CObjectVector<CArc> Arcs;
54   UStringVector VolumePaths;
55   UInt64 VolumesSize;
56   bool IsOpen;
57 
CArchiveLinkCArchiveLink58   CArchiveLink(): VolumesSize(0), IsOpen(false) {}
59   HRESULT Close();
60   void Release();
~CArchiveLinkCArchiveLink61   ~CArchiveLink() { Release(); }
62 
GetArchiveCArchiveLink63   IInArchive *GetArchive() const { return Arcs.Back().Archive; }
64 
65   HRESULT Open(
66     CCodecs *codecs,
67     const CIntVector &formatIndices,
68     bool stdInMode,
69     IInStream *stream,
70     const UString &filePath,
71     IArchiveOpenCallback *callback);
72 
73   HRESULT Open2(
74     CCodecs *codecs,
75     const CIntVector &formatIndices,
76     bool stdInMode,
77     IInStream *stream,
78     const UString &filePath,
79     IOpenCallbackUI *callbackUI);
80 
81   HRESULT ReOpen(
82     CCodecs *codecs,
83     const UString &filePath,
84     IArchiveOpenCallback *callback);
85 };
86 
87 #endif
88