Skip to content

Commit

Permalink
Add support for arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
winexe0 committed Dec 15, 2022
1 parent 797679b commit d98301c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// main.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#define VERSION "BlazeEncryptions v2.0"
#define USAGE "\
Usage: BlazeEncryptions [--old] [--new] [--encrypt] [--decrypt] [--keygen] [-h] [--help] [--version]\n\
Options: --old (Uses the older Encryption/Decryption method for compatibility with BlazeEncryptions v1.x and less secure) --new (Uses the Newer Encryption/Decryption method which is more secure but not compatible with v1.x) --encrypt (Encrypt a message) --decrypt (Decrypt a message) --help or -h (Prints this exact messaage) --version (Prints out the version of this Scalc binary)"
#define COPYRIGHT "Copyright (c) 2022 winexe0 <[email protected]> Albert Nguyen <[email protected]>"
#include <iostream>
#include <string>
#include <vector>
Expand All @@ -8,10 +13,70 @@
#include <sstream>
#include "split.h"
#include "new/new.h"
#include "new/encrypt.h"
#include "new/decrypt.h"
#include "new/keygen.h"
#include "old/old.h"
#include "old/decrypt.h"
#include "old/encrypt.h"
using namespace std;
int main(int argc, char** argv) {
int cryptMethod;
for (int i = 1; i < argc; ++i) {
string arg = argv[i];
if (arg == "--help" || arg == "-h") {
cout << VERSION << endl;
cout << USAGE << endl;
exit(0);
}
if (arg == "--version") {
cout << VERSION << endl;
cout << COPYRIGHT << endl;
exit(0);
}
if (arg == "--old") {
old();
return 0;
}
if (arg == "--new") {
New();
return 0;
}
if (arg == "--encrypt") {
cout << "Which Encryption Method would you like to use:\n1. Newer Encryption Method (More Secure, but not compatible with BlazeEncryptions v1.x)\n2. Older Encryption Method (Less Secure, but compatible with BlazeEncryptions v1.x)\nPlease type 1 or 2 and press enter." << endl;
cin >> cryptMethod;
if (cryptMethod == 1) {
Newencrypt();
return 0;
}
if (cryptMethod == 2) {
encrypt();
return 0;
}
}
if (arg == "--decrypt") {
cout << "Are you decrypting for:\n1. The Newer Encryption Method \n2. The Older Encryption Method\nPlease type 1 or 2 and press enter." << endl;
cin >> cryptMethod;
if (cryptMethod == 1) {
Newencrypt();
return 0;
}
if (cryptMethod == 2) {
encrypt();
return 0;
}
}
if (arg == "--keygen") {
keygen();
}
else {
cout << VERSION << endl;
cout << "Invalid argument" << endl;
cout << USAGE << endl;
exit(0);
}
}
cout << VERSION << endl;
cout << "Which Encryption Method would you like to use:\n1. Newer Encryption Method (More Secure, but not compatible with BlazeEncryptions v1.x)\n2. Older Encryption Method (Less Secure, but compatible with BlazeEncryptions v1.x)\nPlease type 1 or 2 and press enter." << endl;
cin >> cryptMethod;
if (cryptMethod == 1) {
Expand Down

0 comments on commit d98301c

Please sign in to comment.