Integrated DataOutputLayer to ModuleGenerateKey

This commit is contained in:
Leonetienne
2022-05-31 18:19:12 +02:00
parent 0ab87de23c
commit ba37b4325c
2 changed files with 22 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
#include "ModuleGenerateKey.h"
#include "DataOutputLayer.h"
#include "KeyManager.h"
#include "CommandlineInterface.h"
@@ -8,7 +8,24 @@ using namespace Module;
void GenerateKey::Run() {
// Pass KeyManager::GetKey() to data output layer
// Initialize the data output layer
IO::DataOutputLayer::Init();
// Enqueue our single block of data
IO::DataOutputLayer::Enqueue(KeyManager::GetKey());
// Tell the data output layer, that is has received all blocks
IO::DataOutputLayer::ReachedEOF();
// Tell it to write all blocks
// (a single call should suffice, but a while-loop is the proper
// way to do it)
while (!IO::DataOutputLayer::IsFinished()) {
IO::DataOutputLayer::WriteBlock();
}
// Destruct the data output layer
IO::DataOutputLayer::Destruct();
return;
}