5 #include "7zProperties.h"
17 STATPROPSTG StatPROPSTG;
22 { NID::kName, NULL, kpidPath, VT_BSTR},
23 { NID::kSize, NULL, kpidSize, VT_UI8},
24 { NID::kPackInfo, NULL, kpidPackedSize, VT_UI8},
27 { 100, L"Pack0", kpidPackedSize0, VT_UI8},
28 { 101, L"Pack1", kpidPackedSize1, VT_UI8},
29 { 102, L"Pack2", kpidPackedSize2, VT_UI8},
30 { 103, L"Pack3", kpidPackedSize3, VT_UI8},
31 { 104, L"Pack4", kpidPackedSize4, VT_UI8},
34 { NID::kCreationTime, NULL, kpidCreationTime, VT_FILETIME},
35 { NID::kLastWriteTime, NULL, kpidLastWriteTime, VT_FILETIME},
36 { NID::kLastAccessTime, NULL, kpidLastAccessTime, VT_FILETIME},
37 { NID::kWinAttributes, NULL, kpidAttributes, VT_UI4},
38 { NID::kStartPos, NULL, kpidPosition, VT_UI4},
40 { NID::kCRC, NULL, kpidCRC, VT_UI4},
42 { NID::kAnti, NULL, kpidIsAnti, VT_BOOL},
43 // { 97, NULL, kpidSolid, VT_BOOL},
45 { 98, NULL, kpidMethod, VT_BSTR},
46 { 99, NULL, kpidBlock, VT_UI4}
50 static const int kPropMapSize = sizeof(kPropMap) / sizeof(kPropMap[0]);
52 static int FindPropInMap(UInt64 filePropID)
54 for (int i = 0; i < kPropMapSize; i++)
55 if (kPropMap[i].FilePropID == filePropID)
60 static void CopyOneItem(CRecordVector<UInt64> &src,
61 CRecordVector<UInt64> &dest, UInt32 item)
63 for (int i = 0; i < src.Size(); i++)
72 static void RemoveOneItem(CRecordVector<UInt64> &src, UInt32 item)
74 for (int i = 0; i < src.Size(); i++)
82 static void InsertToHead(CRecordVector<UInt64> &dest, UInt32 item)
84 for (int i = 0; i < dest.Size(); i++)
93 void CHandler::FillPopIDs()
95 _fileInfoPopIDs.Clear();
98 if(_volumes.Size() < 1)
100 const CVolume &volume = _volumes.Front();
101 const CArchiveDatabaseEx &_database = volume.Database;
104 CRecordVector<UInt64> fileInfoPopIDs = _database.ArchiveInfo.FileInfoPopIDs;
106 RemoveOneItem(fileInfoPopIDs, NID::kEmptyStream);
107 RemoveOneItem(fileInfoPopIDs, NID::kEmptyFile);
109 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kName);
110 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kAnti);
111 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kSize);
112 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kPackInfo);
113 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCreationTime);
114 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kLastWriteTime);
115 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kLastAccessTime);
116 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kWinAttributes);
117 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCRC);
118 CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kComment);
119 _fileInfoPopIDs += fileInfoPopIDs;
122 _fileInfoPopIDs.Add(98);
123 _fileInfoPopIDs.Add(99);
126 _fileInfoPopIDs.Add(100);
127 _fileInfoPopIDs.Add(101);
128 _fileInfoPopIDs.Add(102);
129 _fileInfoPopIDs.Add(103);
130 _fileInfoPopIDs.Add(104);
134 InsertToHead(_fileInfoPopIDs, NID::kLastWriteTime);
135 InsertToHead(_fileInfoPopIDs, NID::kPackInfo);
136 InsertToHead(_fileInfoPopIDs, NID::kSize);
137 InsertToHead(_fileInfoPopIDs, NID::kName);
141 STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties)
143 *numProperties = _fileInfoPopIDs.Size();
147 STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index,
148 BSTR *name, PROPID *propID, VARTYPE *varType)
150 if((int)index >= _fileInfoPopIDs.Size())
152 int indexInMap = FindPropInMap(_fileInfoPopIDs[index]);
153 if (indexInMap == -1)
155 const STATPROPSTG &srcItem = kPropMap[indexInMap].StatPROPSTG;
156 *propID = srcItem.propid;
157 *varType = srcItem.vt;