First of all, please, sorry if this isn't the right section, hope I'll be excused and mods will move my post.
Scenario: I would like to take into account all the files I am not interested in anymore. I could have deleted them and lost several emule files (known.met, etc.) but I have a text file where some info are stored.
To address the problem I would like to read a list of "known files" in text format, along with the list contained in known.met. For each file, the name, hash and size are known (I have such files, the data were read from old known.met files I processed and then deleted past years). I explored emule code and I think what I need to change is in KnownFileList.cpp function bool CKnownFileList :: LoadKnownFiles (). The main problem seems to me to be avoid collisions among files with the same hash, I suppose the structure of known.met is based on a unique hash in the list (possibly corresponding to more than one file name). My idea is to change the section where the records are read as follows. Of course, to be concise, I wrote a weird mix of code and pseudocode but I hope the organization will be clear anyway.
// MY_MODS: BEGIN ================================== struct CPersonalList { struct CMyKnownFile { string fname ; string hash ; uint64_t size ; bool is_valid ; CMyKnownFile () { is_valid = true ; } } ; // various variables here... // functions void load_all_entries (const char*) ; CMyKnownFile *find_hash (const char*) ; } ; CPersonalList *mymods_list = new CPersonalList ; CPersonalList::CMyKnownFile *probe ; (mymods_list->load_all_entries("my_filename.txt")) ; // MY_MODS: END ==================================== for (UINT i = 0; i < RecordsNumber; i++) { pRecord = new CKnownFile(); if( !pRecord->LoadFromFile(&file,I64Time) ) { TRACE(_T("*** Failed to load entry %u (name=%s hash=%s size=%I64u parthashs=%u expected parthashs=%u) from known.met\n"), i,pRecord->GetFileName(), md4str(pRecord->GetFileHash()), pRecord->GetFileSize(), pRecord->GetFileIdentifier().GetAvailableMD4PartHashCount(), pRecord->GetFileIdentifier().GetTheoreticalMD4PartHashCount() ); delete pRecord; pRecord = NULL; continue; } // MY_MODS: BEGIN ================================== if( ( probe = (mymods_list->find_hash(md4str(pRecord->GetFileHash()) ) != NULL ) (probe->is_valid) = false ; // MY_MODS: END ==================================== SafeAddKFile(pRecord); pRecord = NULL; } // MY_MODS: BEGIN ================================== for( my_list_begin ; my_list_end ; ++iterator ) // hope is clear anyway... { probe = get_next_element (mymods_list) ; if( (probe->is_valid) == true ) { pRecord = new CKnownFile(); [color="#FF0000"]// PROBLEM HERE: how to assign all needed fields in pRecord???[/color] // assign fields do-not-know-how // insert additional record in known files list SafeAddKFile(pRecord); pRecord = NULL; } } // MY_MODS: END ====================================
I'm not a C ++ guru and eMule is a very large program, I don't know if there are any side effects with the above modification. Assuming that I can proceed as above, I don't know to assign the pRecord fields directly and not through the function that reads them from file. Is it possible without problems?
There is also the known_64.met file and I don't know if I have to take it into account. If so I am afraid that I should abandon my idea because of too many points where to get my hands.
I know that there are tools like metmedic and others that can merge different known.met files but they never worked for me, and as I said, I deleted many of them. Modifying the code seems to me the only way to deal with the problem.
Thank you for any advice.
This post has been edited by arkeo: 02 November 2019 - 03:51 PM