small commit

This commit is contained in:
Anonymous275 2020-06-04 17:03:21 +03:00
parent 422e94f833
commit 7d3898568d
3 changed files with 19 additions and 19 deletions

View File

@ -21,8 +21,8 @@ extern bool TCPTerminate;
extern bool MPDEV;
void StartSync(const std::string &Data){
//std::thread t1(ProxyThread,Data.substr(1,Data.find(':')-1),std::stoi(Data.substr(Data.find(':')+1)));
std::thread t1(ProxyThread,"127.0.0.1",30814);
std::thread t1(ProxyThread,Data.substr(1,Data.find(':')-1),std::stoi(Data.substr(Data.find(':')+1)));
//std::thread t1(ProxyThread,"127.0.0.1",30814);
t1.detach();
}

View File

@ -12,7 +12,6 @@ void WinExec(const std::string& cmd);
void Exit(const std::string& Msg);
void CheckForUpdates(const std::string& CV){
system ("cls");
std::string link = "https://beamng-mp.com/builds/launcher?version=true";
std::string HTTP = HTTP_REQUEST(link,443);
link = "https://beamng-mp.com/builds/launcher?download=true";
@ -22,6 +21,7 @@ void CheckForUpdates(const std::string& CV){
struct stat buffer{};
if(stat ("BeamMP-Launcher.back", &buffer) == 0)remove("BeamMP-Launcher.back");
if(HTTP > CV){
system("cls");
std::cout << "Update found!" << std::endl;
std::cout << "Updating..." << std::endl;
SystemExec("rename BeamMP-Launcher.exe BeamMP-Launcher.back>nul");

View File

@ -42,8 +42,7 @@ void Exit(const std::string& Msg){
exit(-1);
}
std::string CheckDir(char*dir, const std::string& ver){
system(("title BeamMP Launcher v" + ver).c_str());
std::string CheckDir(char*dir){
char*temp;size_t len;
struct stat info{};
_dupenv_s(&temp, &len,"APPDATA");
@ -83,23 +82,13 @@ std::string CheckVer(const std::string &path){
return temp;
}
int main(int argc, char* argv[]){
const unsigned long long NPos = std::string::npos;
struct stat info{};
std::string ver = "1.22", link, Path = CheckDir(argv[0],ver),HTTP_Result;
std::thread CFU(CheckForUpdates,ver);
CFU.join();
if(argc > 1){
std::string Port = argv[1];
if(Port.find_first_not_of("0123456789") == NPos){
DEFAULT_PORT = std::stoi(Port);
std::cout << "Running on custom port : " << DEFAULT_PORT << std::endl;
}
}
system("cls");
std::string ver = "1.3", link, HTTP_Result;
SetWindowTextA(GetConsoleWindow(),("BeamMP Launcher v" + ver).c_str());
std::thread t1(Discord_Main);
t1.detach();
std::cout << "Connecting to discord client..." << std::endl;
while(GlobalInfo.empty()){
GlobalInfo = GetDiscordInfo();
@ -116,7 +105,18 @@ int main(int argc, char* argv[]){
}
}
}else MPDEV = true;
std::string Path = CheckDir(argv[0]);
std::thread CFU(CheckForUpdates,ver);
CFU.join();
if(argc > 1){
std::string Port = argv[1];
if(Port.find_first_not_of("0123456789") == NPos){
DEFAULT_PORT = std::stoi(Port);
std::cout << "Running on custom port : " << DEFAULT_PORT << std::endl;
}
}
//Security
auto*Sec = new std::thread(Check);
Sec->join();