Move HTTP Proxy and remove and relocate duplicate code

This commit is contained in:
Tixx
2024-09-07 22:35:27 +02:00
parent de3888618a
commit 452fc1e484
7 changed files with 152 additions and 156 deletions

View File

@@ -14,7 +14,7 @@ public:
static std::string Post(const std::string& IP, const std::string& Fields);
static std::string Get(const std::string& IP);
static bool ProgressBar(size_t c, size_t t);
static void StartProxy();
public:
static bool isDownload;
};

View File

@@ -14,8 +14,8 @@ void InitLauncher(int argc, char* argv[]);
std::string GetEP(char* P = nullptr);
std::string GetGamePath();
std::string GetVer();
std::string GetPatch();
std::string GetEN();
void StartProxy();
void ConfigInit();
extern bool Dev;

20
include/Utils.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <string>
#include <vector>
namespace Utils {
inline std::vector<std::string> Split(const std::string& String, const std::string& delimiter) {
std::vector<std::string> Val;
size_t pos;
std::string token, s = String;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
if (!token.empty())
Val.push_back(token);
s.erase(0, pos + delimiter.length());
}
if (!s.empty())
Val.push_back(s);
return Val;
};
};