Browse Source

load the configuration files

Sven Czarnian 3 years ago
parent
commit
f188b85dcd
1 changed files with 19 additions and 0 deletions
  1. 19 0
      src/PlugIn.cpp

+ 19 - 0
src/PlugIn.cpp

@@ -15,8 +15,13 @@
 #include <Shlwapi.h>
 #include <Windows.h>
 
+#include <aman/config/CommunicationFileFormat.h>
+#include <aman/config/IdentifierFileFormat.h>
+
 #include "PlugIn.h"
 
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+
 using namespace aman;
 
 PlugIn::PlugIn() :
@@ -34,6 +39,20 @@ PlugIn::PlugIn() :
     GetModuleFileNameA((HINSTANCE)&__ImageBase, span.data(), span.size());
     PathRemoveFileSpecA(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 { }