#include<windows.h>
setlocale(LC_ALL, "");
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
const string start_dir = R"(C:\Program Files)";
vector<string> LoadedModule_Hashes;
/*
//release
auto find_hash = [](vector<string> const& hashes, string const& value){
return find(hashes.begin(), hashes.end(), value) != hashes.end();
};
*/
// debug
auto find_hash = [](vector<string> const& hashes, string const& value){
auto it = find_if(hashes.begin(), hashes.end(), [&](string const& hs)
{
cout << "compare:\n" << hs << "\n" << value << "\n";
return hs == value;
});
return it != hashes.end();
};
__forceinline bool LoadGmodLibraryFromRawData(lua_State* L, std::string const& data)
{
if(const string hash = MD5(data).hexdigest(); !find_hash(LoadedModule_Hashes, hash)) // Если не найден
{
LoadedModule_Hashes.push_back(hash);
return true;
}
// Хэш уже есть
return false;
}
true == equal(LoadedModule_Hashes[0].cbegin(),
LoadedModule_Hashes[0].cend(),
LoadedModule_Hashes[1].cbegin());