From 46a31b3fd94b6b7e61348ff386878e7002fa7fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 5 Jul 2021 20:22:47 +0200 Subject: [PATCH] Add VERSION string to libgourou --- include/libgourou.h | 4 ++++ src/libgourou.cpp | 3 ++- utils/acsmdownloader.cpp | 13 +++++++++++-- utils/activate.cpp | 13 +++++++++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/include/libgourou.h b/include/libgourou.h index 2aa6017..4d482cb 100644 --- a/include/libgourou.h +++ b/include/libgourou.h @@ -40,6 +40,8 @@ #define ACS_SERVER "http://adeactivate.adobe.com/adept" #endif +#define LIBGOUROU_VERSION "0.1" + namespace gourou { /** @@ -49,6 +51,8 @@ namespace gourou { public: + static const std::string VERSION; + /** * @brief Main constructor. To be used once all is configured (user has signedIn, device is activated) * diff --git a/src/libgourou.cpp b/src/libgourou.cpp index 54ab1f7..8c100a8 100644 --- a/src/libgourou.cpp +++ b/src/libgourou.cpp @@ -35,7 +35,8 @@ namespace gourou { GOUROU_LOG_LEVEL logLevel = WARN; - + const std::string DRMProcessor::VERSION = LIBGOUROU_VERSION; + DRMProcessor::DRMProcessor(DRMProcessorClient* client):client(client), device(0), user(0) { if (!client) diff --git a/utils/acsmdownloader.cpp b/utils/acsmdownloader.cpp index 3c7a608..ddc3dcb 100644 --- a/utils/acsmdownloader.cpp +++ b/utils/acsmdownloader.cpp @@ -127,6 +127,11 @@ static const char* findFile(const char* filename, bool inDefaultDirs=true) return 0; } +static void version(void) +{ + std::cout << "Current libgourou version : " << gourou::DRMProcessor::VERSION << std::endl ; +} + static void usage(const char* cmd) { std::cout << "Download EPUB file from ACSM request file" << std::endl; @@ -140,6 +145,7 @@ static void usage(const char* cmd) std::cout << " " << "-o|--output-file" << "\t" << "Optional output epub filename (default )" << std::endl; std::cout << " " << "-f|--acsm-file" << "\t" << "ACSM request file for epub download" << std::endl; std::cout << " " << "-v|--verbose" << "\t\t" << "Increase verbosity, can be set multiple times" << std::endl; + std::cout << " " << "-V|--version" << "\t\t" << "Display libgourou version" << std::endl; std::cout << " " << "-h|--help" << "\t\t" << "This help" << std::endl; std::cout << std::endl; @@ -167,11 +173,12 @@ int main(int argc, char** argv) {"output-file", required_argument, 0, 'o' }, {"acsm-file", required_argument, 0, 'f' }, {"verbose", no_argument, 0, 'v' }, + {"version", no_argument, 0, 'V' }, {"help", no_argument, 0, 'h' }, {0, 0, 0, 0 } }; - c = getopt_long(argc, argv, "d:a:k:O:o:f:vh", + c = getopt_long(argc, argv, "d:a:k:O:o:f:vVh", long_options, &option_index); if (c == -1) break; @@ -198,10 +205,12 @@ int main(int argc, char** argv) case 'v': verbose++; break; + case 'V': + version(); + return 0; case 'h': usage(argv[0]); return 0; - break; default: usage(argv[0]); return -1; diff --git a/utils/activate.cpp b/utils/activate.cpp index c089ec1..641a38f 100644 --- a/utils/activate.cpp +++ b/utils/activate.cpp @@ -134,6 +134,11 @@ private: QCoreApplication* app; }; +static void version(void) +{ + std::cout << "Current libgourou version : " << gourou::DRMProcessor::VERSION << std::endl ; +} + static void usage(const char* cmd) { std::cout << "Create new device files used by ADEPT DRM" << std::endl; @@ -146,6 +151,7 @@ static void usage(const char* cmd) std::cout << " " << "-H|--hobbes-version" << "\t"<< "Force RMSDK version to a specific value (default: version of current librmsdk)" << std::endl; std::cout << " " << "-r|--random-serial" << "\t"<< "Generate a random device serial (if not set, it will be dependent of your current configuration)" << std::endl; std::cout << " " << "-v|--verbose" << "\t\t" << "Increase verbosity, can be set multiple times" << std::endl; + std::cout << " " << "-V|--version" << "\t\t" << "Display libgourou version" << std::endl; std::cout << " " << "-h|--help" << "\t\t" << "This help" << std::endl; std::cout << std::endl; @@ -177,11 +183,12 @@ int main(int argc, char** argv) {"hobbes-version",required_argument, 0, 'H' }, {"random-serial", no_argument, 0, 'r' }, {"verbose", no_argument, 0, 'v' }, + {"version", no_argument, 0, 'V' }, {"help", no_argument, 0, 'h' }, {0, 0, 0, 0 } }; - c = getopt_long(argc, argv, "u:p:O:H:rvh", + c = getopt_long(argc, argv, "u:p:O:H:rvVh", long_options, &option_index); if (c == -1) break; @@ -202,10 +209,12 @@ int main(int argc, char** argv) case 'v': verbose++; break; + case 'V': + version(); + return 0; case 'h': usage(argv[0]); return 0; - break; case 'r': randomSerial = true; break;