v3.5.4 fix errors

This commit is contained in:
Markus 2019-10-31 15:09:09 +01:00
parent f00d85c8d1
commit 6216ee60c0
5 changed files with 18 additions and 12 deletions

View File

@ -5,8 +5,12 @@ int main(int argc, char *argv[])
ProgramManager mainProgram; ProgramManager mainProgram;
Settings settings; Settings settings;
int res = manageParameter(settings, argc, argv); int res = manageParameter(settings, argc, argv);
if(res != 0) if(res == -1)
return (res == -1) ? 0 : res; return 0;

else if(res != 0) {
std::cout << " => Error: Das Auswerten der Parameter ist fehlgeschlagen!" << std::endl;
return res;
} else {
return mainProgram.start(&settings); return mainProgram.start(&settings);
}
} }

View File

@ -14,6 +14,8 @@ PageManager::~PageManager()
void PageManager::setProxy(std::string ip, int port) void PageManager::setProxy(std::string ip, int port)
{ {
this->sock5Proxy = "socks5://" + ip + ":" + std::to_string(port); this->sock5Proxy = "socks5://" + ip + ":" + std::to_string(port);
if(debugMode)
std::cout << "Proxy: " << ip << ":" << port << std::endl;
} }


void PageManager::setCookieFilePath(std::string path) void PageManager::setCookieFilePath(std::string path)

View File

@ -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 ) { 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) { switch(c) {
case 'p': case 'p':
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
return 2; return 2;
break; break;
case 'g': 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 ) { while( ( c = getopt_long (argc, argv, "p:o:hcd", long_opts, nullptr) ) != -1 ) {
switch(c) { switch(c) {
case 'p': case 'p':
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
return 2; return 2;
break; break;
case 'o': 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 ) { while( ( c = getopt_long (argc, argv, "p:hcdeu", long_opts, nullptr) ) != -1 ) {
switch(c) { switch(c) {
case 'p': case 'p':
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
return 2; return 2;
break; break;
case 'h': 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 ) { while( ( c = getopt_long (argc, argv, "p:hcds", long_opts, nullptr) ) != -1 ) {
switch(c) { switch(c) {
case 'p': case 'p':
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
return 2; return 2;
break; break;
case 'h': 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 ) { while( ( c = getopt_long (argc, argv, "p:hcd", long_opts, nullptr) ) != -1 ) {
switch(c) { switch(c) {
case 'p': case 'p':
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
return 2; return 2;
break; break;
case 'h': 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 ) { while( ( c = getopt_long (argc, argv, "p:hd", long_opts, nullptr) ) != -1 ) {
switch(c) { switch(c) {
case 'p': case 'p':
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0) if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
return 2; return 2;
break; break;
case 'h': case 'h':

View File

@ -63,7 +63,7 @@ struct Settings {
proxy_ip = "127.0.0.1", proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng,", languages = "GerDub,GerSub,Eng,",
genaueHoster = "", genaueHoster = "",
version = "3.5.3", version = "3.5.4",
defaultFileVersion="1.6", defaultFileVersion="1.6",
outputFilePath = "", outputFilePath = "",
default_checkPath = "", default_checkPath = "",

View File

@ -18,8 +18,8 @@ ProgramManager::~ProgramManager()


int ProgramManager::start(Settings *settings) int ProgramManager::start(Settings *settings)
{ {
pageManager.setProxy(settings->proxy_ip, settings->proxy_port);
pageManager.setDebugMode(settings->debugMode); pageManager.setDebugMode(settings->debugMode);
pageManager.setProxy(settings->proxy_ip, settings->proxy_port);
pageManager.setCookieFilePath(settings->cookieFilePath); pageManager.setCookieFilePath(settings->cookieFilePath);
if(dirExists(settings->cookieFilePath)) { if(dirExists(settings->cookieFilePath)) {
std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '" std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '"