Add exceptoins
This commit is contained in:
parent
dddc2d16f6
commit
fad87e9944
@ -10,6 +10,29 @@ void Configuration::Parse() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Configuration::DecideModule() {
|
||||||
|
if (CommandlineInterface::Get().HasParam("--encrypt")) {
|
||||||
|
activeModule = MODULE::ENCRYPT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (CommandlineInterface::Get().HasParam("--decrypt")) {
|
||||||
|
activeModule = MODULE::DECRYPT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (CommandlineInterface::Get().HasParam("--hash")) {
|
||||||
|
activeModule = MODULE::HASH;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (CommandlineInterface::Get().HasParam("--generate-keyfile")) {
|
||||||
|
activeModule = MODULE::GENERATE_KEYFILE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw std::runtime_error("No module option found. Is the CLI parser configuration correct?.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void Configuration::DecideInputFrom() {
|
void Configuration::DecideInputFrom() {
|
||||||
|
|
||||||
if (CommandlineInterface::Get().HasParam("--intext")) {
|
if (CommandlineInterface::Get().HasParam("--intext")) {
|
||||||
@ -46,23 +69,6 @@ void Configuration::DecideOutputTo() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configuration::DecideModule() {
|
|
||||||
if (CommandlineInterface::Get().HasParam("--encrypt")) {
|
|
||||||
activeModule = MODULE::ENCRYPT;
|
|
||||||
}
|
|
||||||
else if (CommandlineInterface::Get().HasParam("--decrypt")) {
|
|
||||||
activeModule == MODULE::DECRYPT;
|
|
||||||
}
|
|
||||||
else if (CommandlineInterface::Get().HasParam("--hash")) {
|
|
||||||
activeModule == MODULE::HASH;
|
|
||||||
}
|
|
||||||
else if (CommandlineInterface::Get().HasParam("--generate-keyfile")) {
|
|
||||||
activeModule == MODULE::GENERATE_KEYFILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Configuration::DecideIOBaseFormat() {
|
void Configuration::DecideIOBaseFormat() {
|
||||||
|
|
||||||
// Do we have any iobase specified?
|
// Do we have any iobase specified?
|
||||||
@ -144,6 +150,11 @@ void Configuration::DecideIOBaseFormat() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback: Bytes
|
||||||
|
else {
|
||||||
|
iobaseFormat = IOBASE_FORMAT::BASE_BYTES;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,9 @@ void ModulePrepareKey::PrepareKey() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw std::runtime_error("No key option found. Is the CLI parser configuration correct?.");
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ int main(int argc, char* const* argv) {
|
|||||||
// Prepare the key
|
// Prepare the key
|
||||||
ModulePrepareKey::PrepareKey();
|
ModulePrepareKey::PrepareKey();
|
||||||
|
|
||||||
|
std::cout << ModulePrepareKey::GetKey().ToHexString() << std::endl;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user