Implement progress output
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "ModuleDecryption.h"
|
||||
#include "DataIngestionLayer.h"
|
||||
#include "DataOutputLayer.h"
|
||||
#include "ProgressPrinter.h"
|
||||
#include "KeyManager.h"
|
||||
#include <GCrypt/GCipher.h>
|
||||
|
||||
@@ -21,6 +22,7 @@ void Decryption::Run() {
|
||||
GCipher::DIRECTION::DECIPHER
|
||||
);
|
||||
|
||||
std::size_t nBlocksDigested = 0;
|
||||
while (!IO::DataOutputLayer::IsFinished()) {
|
||||
// Read in new blocks, if not reached eof
|
||||
if (!IO::DataIngestionLayer::ReachedEOF()) {
|
||||
@@ -29,8 +31,17 @@ void Decryption::Run() {
|
||||
|
||||
// Process a block, if one is ready
|
||||
if (IO::DataIngestionLayer::IsBlockReady()) {
|
||||
|
||||
// Print progress, if appropriate
|
||||
ProgressPrinter::PrintIfAppropriate(
|
||||
"Decrypting",
|
||||
nBlocksDigested,
|
||||
IO::DataIngestionLayer::NBlocksRead()
|
||||
);
|
||||
|
||||
const Block cleartext = IO::DataIngestionLayer::GetNextBlock();
|
||||
const Block ciphertext = cipher.Digest(cleartext);
|
||||
nBlocksDigested++;
|
||||
|
||||
// Enqueue the block for output
|
||||
IO::DataOutputLayer::Enqueue(ciphertext);
|
||||
|
||||
Reference in New Issue
Block a user