#define MAXPUBKEYSIZE80
struct CreditStruct{
ucharabyKey[16];
uint32nUploadedLo; // uploaded TO him
uint32nDownloadedLo; // downloaded from him
uint32nLastSeen;
uint32nUploadedHi; // upload high 32
uint32nDownloadedHi; // download high 32
uint16nReserved3;
uint8nKeySize;
ucharabySecureIdent[MAXPUBKEYSIZE];
};
从第6个字节开始:
for (UINT i = 0; i < count; i++){
CreditStruct* newcstruct = new CreditStruct;
memset(newcstruct, 0, sizeof(CreditStruct));
if (version == CREDITFILE_VERSION_29)
file.Read(newcstruct, sizeof(CreditStruct_29a));
else
file.Read(newcstruct, sizeof(CreditStruct));
if (newcstruct->nLastSeen < dwExpired){
cDeleted++;
delete newcstruct;
continue;
}
CClientCredits* newcredits = new CClientCredits(newcstruct);
m_mapClients.SetAt(CCKey(newcredits->GetKey()), newcredits);
}