From 2d0b97bbbabd99c57751efcae29394eeecef86ee Mon Sep 17 00:00:00 2001 From: cora48 Date: Mon, 23 Mar 2015 12:37:02 +0300 Subject: [PATCH] Shuffle and NSTrack option saving fix --- mainResources.h | 13 ---------- nesca_3.cpp | 39 +++++++++++++++++++++++------ nesca_startModule.cpp | 58 ++++++++++++++++--------------------------- 3 files changed, 53 insertions(+), 57 deletions(-) diff --git a/mainResources.h b/mainResources.h index 3fed2f5..bbb21b5 100644 --- a/mainResources.h +++ b/mainResources.h @@ -150,17 +150,6 @@ class Connector_old public: int _Updater(); - // lopaStr _FTPLobby(char *ip, - // int port, - // PathStr *ps); - - // lopaStr _BALobby(char *cookie, - // char *ip, - // int port, - // char *path, - // char *method, - // char *data); - lopaStr _WFLobby(char *cookie, char *ip, int port, @@ -187,5 +176,3 @@ public: extern lopaStr _IPCameraBLobby(const char *ip, int port, char *SPEC); -//extern lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method); -//extern lopaStr _FTPLobby(char *ip, int port, PathStr *ps); diff --git a/nesca_3.cpp b/nesca_3.cpp index 89c3b4f..d1e5f76 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -3126,16 +3126,23 @@ void RestoreSession() PortString.replace("\n", ""); - ui->lineEditPort->setText(PortString); - ui->portLine->setText(PortString); - ui->importPorts->setText(PortString); + if(PortString.length() > 0) { + ui->lineEditPort->setText(PortString); + ui->portLine->setText(PortString); + ui->importPorts->setText(PortString); + } else { + ui->lineEditPort->setText(PORTSET); + ui->portLine->setText(PORTSET); + ui->importPorts->setText(PORTSET); + } delete []fPorts; } else - { - ui->lineEditPort->setText(PORTSET); - ui->portLine->setText(PORTSET); + { + ui->lineEditPort->setText(PORTSET); + ui->portLine->setText(PORTSET); + ui->importPorts->setText(PORTSET); }; }; @@ -3150,6 +3157,22 @@ void RestoreSession() lex[strlen(lex) - 1] = '\0'; ui->pingingOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false); }; + } else if (strstr(resStr, "[SHUFFLE]:") != NULL) { + lex = strstr(resStr, "[SHUFFLE]:") + strlen("[SHUFFLE]:"); + + if (strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->shuffle_onoff->setChecked(strcmp(lex, "true") == 0 ? true : false); + }; + } else if (strstr(resStr, "[NSTRACK]:") != NULL) { + lex = strstr(resStr, "[NSTRACK]:") + strlen("[NSTRACK]:"); + + if (strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->trackerOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false); + }; } setUIText("[PING_TO]:", ui->PingTO, resStr); setUIText("[THREAD_DELAY]:", ui->threadDelayBox, resStr); @@ -3157,8 +3180,8 @@ void RestoreSession() const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:"); if(tempLex.toInt() > 0) { ui->iptoLine_value->setText(tempLex.simplified()); - ui->iptoLine_value_2->setText(tempLex.simplified()); - ui->iptoLine_value_3->setText(tempLex.simplified()); + ui->iptoLine_value_2->setText(tempLex.simplified()); + ui->iptoLine_value_3->setText(tempLex.simplified()); } } setUIText("[MAXBTHR]:", ui->maxBrutingThrBox, resStr); diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index 7253897..e61b44b 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -245,72 +245,58 @@ void _SaveBackupToFile() ZeroMemory(saveStr, sizeof(saveStr)); }; - strcpy(saveStr, "[NDBSERVER]:"); - strcat(saveStr, trcSrv); - strcat(saveStr, "\n"); + sprintf(saveStr, "[NDBSERVER]:%s\n", trcSrv); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[NDBSCRIPT]:"); - strcat(saveStr, trcScr); - strcat(saveStr, "\n"); + sprintf(saveStr, "[NDBSCRIPT]:%s\n", trcScr); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[NDBPORT]:"); - strcat(saveStr, trcSrvPortLine); - strcat(saveStr, "\n"); + sprintf(saveStr, "[NDBPORT]:%s\n", trcSrvPortLine); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[PROXY]:"); - strcat(saveStr, trcProxy); - strcat(saveStr, "\n"); + sprintf(saveStr, "[PROXY]:%s\n", trcProxy); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[PROXYPORT]:"); - strcat(saveStr, trcPort); - strcat(saveStr, "\n"); + sprintf(saveStr, "[PROXYPORT]:%s\n", trcPort); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[IRCSERVER]:"); - strcat(saveStr, ircServer); - strcat(saveStr, "\n"); + sprintf(saveStr, "[IRCSERVER]:%s\n", ircServer); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[IRCPORT]:"); - strcat(saveStr, ircPort); - strcat(saveStr, "\n"); + sprintf(saveStr, "[IRCPORT]:%s\n", ircPort); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[IRCPROXY]:"); - strcat(saveStr, ircProxy); - strcat(saveStr, "\n"); + sprintf(saveStr, "[IRCPROXY]:%s\n", ircProxy); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[IRCPROXYPORT]:"); - strcat(saveStr, ircProxyPort); - strcat(saveStr, "\n"); + sprintf(saveStr, "[IRCPROXYPORT]:%s\n", ircProxyPort); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); - strcpy(saveStr, "[IRCNICK]:"); - strcat(saveStr, ircNick); - strcat(saveStr, "\n"); - strcat(saveBuffer, saveStr); - ZeroMemory(saveStr, sizeof(saveStr)); - - strcpy(saveStr, "[PING]:"); - strcat(saveStr, gPingNScan ? "true" : "false"); - strcat(saveStr, "\n"); + sprintf(saveStr, "[IRCNICK]:%s\n", ircNick); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr)); + sprintf(saveStr, "[PING]:%s\n", gPingNScan ? "true" : "false"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + sprintf(saveStr, "[SHUFFLE]:%s\n", gShuffle ? "true" : "false"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + sprintf(saveStr, "[NSTRACK]:%s\n", trackerOK ? "true" : "false"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + sprintf(saveStr, "[PING_TO]: %d\n", gPingTimeout); strcat(saveBuffer, saveStr); ZeroMemory(saveStr, sizeof(saveStr));