1
0
mirror of synced 2025-01-29 19:17:28 +01:00

Improved thingy file parsing

This commit is contained in:
WerWolv 2021-02-14 12:05:58 +01:00
parent 1eb6f781b3
commit 714b62049c

View File

@ -31,15 +31,22 @@ namespace hex {
void EncodingFile::parseThingyFile(std::ifstream &content) {
for (std::string line; std::getline(content, line);) {
auto entry = hex::splitString(line, "=");
if (entry.size() != 2) return;
std::string from, to;
{
auto delimiterPos = line.find('=', 0);
auto &from = entry[0];
auto &to = entry[1];
if (delimiterPos == std::string::npos)
continue;
hex::trim(from);
hex::trim(to);
from = line.substr(0, delimiterPos);
to = line.substr(delimiterPos + 1);
hex::trim(from);
hex::trim(to);
if (to.empty()) to = " ";
}
auto fromBytes = hex::parseByteString(from);
if (!this->m_mapping.contains(fromBytes.size()))