MCPcopy Create free account
hub / github.com/amule-project/amule / DecodePartMetFile

Function DecodePartMetFile

src/utils/fileview/eD2kFiles.cpp:211–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void DecodePartMetFile(const CFileDataIO& file)
212{
213 uint16_t PartCount = 0;
214 uint8_t version = file.ReadUInt8();
215 cout << "Version : " << VersionInfo(version, PartMetFile) << endl;
216 if (version != PARTFILE_VERSION && version != PARTFILE_SPLITTEDVERSION && version != PARTFILE_VERSION_LARGEFILE) {
217 cerr << "File seems to be corrupt, invalid version!" << endl;
218 return;
219 }
220 bool isnewstyle = (version == PARTFILE_SPLITTEDVERSION);
221 if (!isnewstyle) {
222 uint8_t test[4];
223 file.Seek(24, wxFromStart);
224 file.Read(test, 4);
225 file.Seek(1, wxFromStart);
226 if (test[0] == 0 && test[1] == 0 && test[2] == 2 && test[3] == 1) {
227 isnewstyle = true;
228 }
229 }
230 if (isnewstyle) {
231 uint32_t temp = file.ReadUInt32();
232 if (temp == 0) {
233 PrintHashsetFromFile(file);
234 } else {
235 file.Seek(2, wxFromStart);
236 PrintDateFromFile(file);
237 cout << "FileHash : " << file.ReadHash() << '\n';
238 }
239 } else {
240 PrintDateFromFile(file);
241 PrintHashsetFromFile(file);
242 }
243 uint32_t tagCount = file.ReadUInt32();
244 cout << "TagCount : " << tagCount << '\n';
245 for (; tagCount > 0; tagCount--) {
246 CTag tag(file, true);
247 if (tag.GetNameID() == FT_FILESIZE) {
248 PartCount = (tag.GetInt() + (PARTSIZE - 1)) / PARTSIZE;
249 }
250 cout << '\t' << tag << '\n';
251 }
252 if (isnewstyle && (file.GetPosition() < file.GetLength())) {
253 file.Seek(1, wxFromCurrent);
254 cout << "HashSet : ";
255 for (uint16_t i = 0; i < PartCount && (file.GetPosition() + 16 < file.GetLength()); i++) {
256 if (i) {
257 cout << ", ";
258 }
259 cout << file.ReadHash();
260 }
261 }
262 cout << '\n';
263}
264
265void DecodeStatisticsDat(const CFileDataIO& file)
266{

Callers 1

OnRunMethod · 0.85

Calls 12

VersionInfoFunction · 0.85
PrintHashsetFromFileFunction · 0.85
PrintDateFromFileFunction · 0.85
ReadUInt8Method · 0.80
SeekMethod · 0.80
ReadUInt32Method · 0.80
GetNameIDMethod · 0.80
ReadMethod · 0.45
ReadHashMethod · 0.45
GetIntMethod · 0.45
GetPositionMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected