load the configuration files

This commit is contained in:
Sven Czarnian
2021-08-11 08:29:38 +02:00
parent fad3ca0de1
commit f188b85dcd

View File

@@ -15,8 +15,13 @@
#include <Shlwapi.h> #include <Shlwapi.h>
#include <Windows.h> #include <Windows.h>
#include <aman/config/CommunicationFileFormat.h>
#include <aman/config/IdentifierFileFormat.h>
#include "PlugIn.h" #include "PlugIn.h"
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
using namespace aman; using namespace aman;
PlugIn::PlugIn() : PlugIn::PlugIn() :
@@ -34,6 +39,20 @@ PlugIn::PlugIn() :
GetModuleFileNameA((HINSTANCE)&__ImageBase, span.data(), span.size()); GetModuleFileNameA((HINSTANCE)&__ImageBase, span.data(), span.size());
PathRemoveFileSpecA(span.data()); PathRemoveFileSpecA(span.data());
std::string dllPath = span.data(); std::string dllPath = span.data();
CommunicationFileFormat comFormat;
if (false == comFormat.parse(dllPath + "\\AmanCommunication.txt", this->m_configuration) || true == comFormat.errorFound()) {
this->DisplayUserMessage(PLUGIN_NAME, "ERROR", "Unable to parse AmanCommunication.txt", true, true, true, true, true);
this->DisplayUserMessage(PLUGIN_NAME, "ERROR", ("AmanCommunication.txt:" + std::to_string(comFormat.errorLine()) + " - " + comFormat.errorMessage()).c_str(), true, true, true, true, true);
return;
}
IdentifierFileFormat identFormat;
if (false == identFormat.parse(dllPath + "\\AmanIdentity.txt", this->m_configuration) || true == identFormat.errorFound()) {
this->DisplayUserMessage(PLUGIN_NAME, "ERROR", "Unable to parse AmanIdentity.txt", true, true, true, true, true);
this->DisplayUserMessage(PLUGIN_NAME, "ERROR", ("AmanIdentity.txt:" + std::to_string(identFormat.errorLine()) + " - " + identFormat.errorMessage()).c_str(), true, true, true, true, true);
return;
}
} }
PlugIn::~PlugIn() noexcept { } PlugIn::~PlugIn() noexcept { }