S_New4/g++/parameterManager.h

93 lines
2.3 KiB
C
Raw Normal View History

#ifndef PARAMETERMANAGER_H
#define PARAMETERMANAGER_H
#include <iostream>
#include <getopt.h>
#include <string.h>
#include <sstream>
2019-08-03 16:27:05 +00:00
#include <sys/stat.h>
2019-08-19 15:32:52 +00:00
#include <fstream>
2019-08-13 16:59:01 +00:00
#include <limits.h> // PATH_MAX
#include <unistd.h> // readlink()
#ifdef _WIN32
#include <windows.h>
#endif
enum Modus {
EXIT = -1,
DEFAULT_MODUS = 0,
2019-08-03 16:27:05 +00:00
DIRECT_LINK_MODUS = 1,
2019-08-13 16:59:01 +00:00
SEARCH_MODUS = 2,
INFO_MODUS = 3
2019-08-11 14:52:23 +00:00
};
struct Settings {
Settings() {}
Settings(std::string name) : name(name) {}
std::string name,
accountFilePath = "/tmp/a",
2019-08-19 15:32:52 +00:00
accountNumberPath= "/tmp/a_n",
cookieFilePath = "/tmp/S_New4_cookies",
2019-08-03 16:27:05 +00:00
serienListPath = "/tmp/SerienListe",
2019-08-19 15:32:52 +00:00
defaultsFilePath = "/tmp/defaults",
proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng",
2019-08-13 16:59:01 +00:00
genaueHoster = "Vivo,GoUnlimited",
2019-08-19 15:32:52 +00:00
version = "2.3.0",
defaultFileVersion="1.3",
2019-08-11 14:52:23 +00:00
outputFilePath = "",
default_checkDirPath = "",
default_Searchmuster = "S%Staffel%E%Folge%";
Modus modus = Modus::DEFAULT_MODUS;
bool colorless = false,
2019-08-03 16:27:05 +00:00
debugMode = false,
search_IgnoreUpperLower = true,
search_wantUpdate = false;
int startEpisode = 1,
stopEpisode = 0,
startSeason = 1,
2019-08-03 16:27:05 +00:00
stopSeason = 0,
2019-08-11 14:52:23 +00:00
proxy_port = 9050,
default_maxDirs = 20;
2019-08-13 16:59:01 +00:00
char pathSymbol = '/';
2019-08-19 15:32:52 +00:00
unsigned maxThreads = 0;
};
2019-08-03 16:27:05 +00:00
int manageParameter(Settings &settings, int argc, char ** argv);
2019-08-19 15:32:52 +00:00
int loadDefaulOptions(Settings & settings);
int compare(std::string All_Options_with_komma_between, std::string input);
2019-08-19 15:32:52 +00:00
std::string getProgramName();
2019-08-13 16:59:01 +00:00
std::string getexepath();
2019-08-19 15:32:52 +00:00
2019-08-13 16:59:01 +00:00
void setPathSymbol(Settings &settings);
2019-08-19 15:32:52 +00:00
void setPaths(Settings &settings);
2019-08-13 16:59:01 +00:00
2019-08-19 15:32:52 +00:00
bool fileExists (const std::string& name);
bool dirExists(std::string dir);
2019-08-13 16:59:01 +00:00
int unterOption_help();
2019-08-03 16:27:05 +00:00
int unterOption_default(Settings * settings, int argc, char **argv);
2019-08-13 16:59:01 +00:00
void unterOption_default_help();
2019-08-03 16:27:05 +00:00
int unterOption_url(Settings * settings, int argc, char **argv);
2019-08-13 16:59:01 +00:00
void unterOption_url_help();
2019-08-03 16:27:05 +00:00
int unterOption_search(Settings * settings, int argc, char **argv);
2019-08-13 16:59:01 +00:00
void unterOption_search_help();
2019-08-03 16:27:05 +00:00
2019-08-13 16:59:01 +00:00
int unterOption_info(Settings * settings, int argc, char **argv);
void unterOption_info_help();
2019-08-03 16:27:05 +00:00
2019-08-19 15:32:52 +00:00
void unterOption_clean(Settings * settings, int argc, char **argv);
#endif // PARAMETERMANAGER_H