forked from markus/S_New4
143 lines
3.7 KiB
C++
143 lines
3.7 KiB
C++
#ifndef PARAMETERMANAGER_H
|
|
#define PARAMETERMANAGER_H
|
|
|
|
#ifndef __linux__
|
|
#ifndef _WIN32
|
|
#error "Error Invalid System: Only for Linux and Windows systems!"
|
|
#endif
|
|
#endif
|
|
|
|
#include <iostream>
|
|
#include <getopt.h>
|
|
#include <string.h> // strlen
|
|
#include <sstream>
|
|
#include <sys/stat.h>
|
|
#include <fstream>
|
|
#include <vector>
|
|
|
|
#include <limits.h> // PATH_MAX
|
|
#include <unistd.h> // readlink()
|
|
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
enum Modus {
|
|
EXIT = -1,
|
|
DEFAULT_MODUS = 0,
|
|
DIRECT_LINK_MODUS = 1,
|
|
SEARCH_MODUS = 2,
|
|
INFO_MODUS = 3,
|
|
NEWS_MODUS = 4,
|
|
UPDATE_MODUS = 5
|
|
|
|
};
|
|
|
|
|
|
struct Settings {
|
|
Settings() {}
|
|
Settings(std::string name) : name(name) {}
|
|
|
|
const std::string programName = "S_New4";
|
|
#ifdef __linux
|
|
const std::string VersionFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=Version-LINx86.txt";
|
|
const std::string ProgrammFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=S_New4-LINx86";
|
|
#endif
|
|
#ifdef _WIN32
|
|
const std::string VersionFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=Version-WINx86.txt";
|
|
const std::string ProgrammFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=S_New4-WINx86.exe";
|
|
#endif
|
|
std::string name,
|
|
accountFilePath = "/tmp/a",
|
|
accountNumberPath= "/tmp/a_n",
|
|
cookieFilePath = "/tmp/S_New4_cookies",
|
|
serienListPath = "/tmp/SerienListe",
|
|
lastUpdateDateFilePath = "/tmp/lastUpdateDateFile",
|
|
configDir="/tmp/",
|
|
cacheDir="/tmp/",
|
|
|
|
defaultsFilePath = "/tmp/defaults",
|
|
proxy_ip = "127.0.0.1",
|
|
languages = "GerDub,GerSub,Eng",
|
|
genaueHoster = "",
|
|
version = "3.3.0",
|
|
defaultFileVersion="1.6",
|
|
outputFilePath = "",
|
|
default_checkPath = "",
|
|
default_Searchmuster = "S%Staffel%E%Folge%";
|
|
|
|
Modus modus = Modus::DEFAULT_MODUS;
|
|
bool colorless = false,
|
|
debugMode = false,
|
|
search_IgnoreUpperLower = true,
|
|
search_wantUpdate = false;
|
|
int startEpisode = 1,
|
|
stopEpisode = 0,
|
|
startSeason = 1,
|
|
stopSeason = 0,
|
|
proxy_port = 9050,
|
|
default_maxDirs = 20,
|
|
updateWarningDays = 10;
|
|
char pathSymbol = '/';
|
|
unsigned maxThreads = 0;
|
|
|
|
};
|
|
|
|
int manageParameter(Settings &settings, int argc, char ** argv);
|
|
int loadDefaulOptions(Settings & settings);
|
|
std::vector<std::string> compare(std::string All_Options_with_komma_between, std::string input);
|
|
bool isNumber(std::string number);
|
|
|
|
int setPaths(Settings &settings);
|
|
|
|
bool fileExists (const std::string& name);
|
|
bool dirExists(std::string dir);
|
|
bool nothingExists(std::string path);
|
|
|
|
bool createDirIsOk(std::string path);
|
|
bool makePathIsOk(std::string path);
|
|
|
|
int unterOption_help(Settings &settings);
|
|
void unterOption_printVersion(Settings &settings);
|
|
|
|
int unterOption_default(Settings * settings, int argc, char **argv);
|
|
void unterOption_default_help(std::string programName);
|
|
|
|
int unterOption_url(Settings * settings, int argc, char **argv);
|
|
void unterOption_url_help(std::string programName);
|
|
|
|
int unterOption_search(Settings * settings, int argc, char **argv);
|
|
void unterOption_search_help(std::string programName);
|
|
|
|
int unterOption_info(Settings * settings, int argc, char **argv);
|
|
void unterOption_info_help(std::string programName);
|
|
|
|
void unterOption_clean(Settings * settings, int argc, char **argv);
|
|
|
|
int unterOption_news(Settings * settings, int argc, char **argv);
|
|
void unterOption_news_help(std::string programName);
|
|
|
|
int unterOption_update(Settings * settings, int argc, char **argv);
|
|
void unterOption_update_help(std::string programName);
|
|
|
|
int setS5ProxytoSettings(Settings &settings, std::string optarg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PARAMETERMANAGER_H
|