From 6216ee60c0aecebcababfab5cbb7bc629623ffb7 Mon Sep 17 00:00:00 2001 From: Markus Date: Thu, 31 Oct 2019 15:09:09 +0100 Subject: [PATCH] v3.5.4 fix errors --- main.cpp | 12 ++++++++---- pageManager.cpp | 2 ++ parameterManager.cpp | 12 ++++++------ parameterManager.h | 2 +- programManager.cpp | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/main.cpp b/main.cpp index f7aa8d0..69c167e 100644 --- a/main.cpp +++ b/main.cpp @@ -5,8 +5,12 @@ int main(int argc, char *argv[]) ProgramManager mainProgram; Settings settings; int res = manageParameter(settings, argc, argv); - if(res != 0) - return (res == -1) ? 0 : res; - - return mainProgram.start(&settings); + if(res == -1) + return 0; + else if(res != 0) { + std::cout << " => Error: Das Auswerten der Parameter ist fehlgeschlagen!" << std::endl; + return res; + } else { + return mainProgram.start(&settings); + } } diff --git a/pageManager.cpp b/pageManager.cpp index 8cd8a3f..a704ef0 100644 --- a/pageManager.cpp +++ b/pageManager.cpp @@ -14,6 +14,8 @@ PageManager::~PageManager() void PageManager::setProxy(std::string ip, int port) { this->sock5Proxy = "socks5://" + ip + ":" + std::to_string(port); + if(debugMode) + std::cout << "Proxy: " << ip << ":" << port << std::endl; } void PageManager::setCookieFilePath(std::string path) diff --git a/parameterManager.cpp b/parameterManager.cpp index 7197892..66dd849 100644 --- a/parameterManager.cpp +++ b/parameterManager.cpp @@ -399,7 +399,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv) while( ( c = getopt_long (argc, argv, "p:g:l:o:e:E:s:S:C:m:D:t:hcd", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': - if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) + if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) return 2; break; case 'g': @@ -677,7 +677,7 @@ int unterOption_url(Settings *settings, int argc, char **argv) while( ( c = getopt_long (argc, argv, "p:o:hcd", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': - if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) + if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) return 2; break; case 'o': @@ -774,7 +774,7 @@ int unterOption_search(Settings *settings, int argc, char **argv) while( ( c = getopt_long (argc, argv, "p:hcdeu", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': - if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) + if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) return 2; break; case 'h': @@ -884,7 +884,7 @@ int unterOption_info(Settings *settings, int argc, char **argv) while( ( c = getopt_long (argc, argv, "p:hcds", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': - if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) + if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) return 2; break; case 'h': @@ -1157,7 +1157,7 @@ int unterOption_news(Settings *settings, int argc, char **argv) while( ( c = getopt_long (argc, argv, "p:hcd", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': - if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) + if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) return 2; break; case 'h': @@ -1225,7 +1225,7 @@ int unterOption_update(Settings *settings, int argc, char **argv) while( ( c = getopt_long (argc, argv, "p:hd", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': - if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) + if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) return 2; break; case 'h': diff --git a/parameterManager.h b/parameterManager.h index 9af87d0..2fdd2cf 100644 --- a/parameterManager.h +++ b/parameterManager.h @@ -63,7 +63,7 @@ struct Settings { proxy_ip = "127.0.0.1", languages = "GerDub,GerSub,Eng,", genaueHoster = "", - version = "3.5.3", + version = "3.5.4", defaultFileVersion="1.6", outputFilePath = "", default_checkPath = "", diff --git a/programManager.cpp b/programManager.cpp index 553fd92..0cc2879 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -18,8 +18,8 @@ ProgramManager::~ProgramManager() int ProgramManager::start(Settings *settings) { - pageManager.setProxy(settings->proxy_ip, settings->proxy_port); pageManager.setDebugMode(settings->debugMode); + pageManager.setProxy(settings->proxy_ip, settings->proxy_port); pageManager.setCookieFilePath(settings->cookieFilePath); if(dirExists(settings->cookieFilePath)) { std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '"