Mod downloading hotfix

This commit is contained in:
Anonymous275 2020-12-27 00:23:58 +02:00
parent 9a04665c34
commit 9f821a01f0
2 changed files with 4 additions and 6 deletions

View File

@ -244,7 +244,6 @@ void SyncResources(SOCKET Sock){
} }
if(!FNames.empty())info("Syncing..."); if(!FNames.empty())info("Syncing...");
SOCKET DSock = InitDSock(); SOCKET DSock = InitDSock();
uint64_t ModSize;
for(auto FN = FNames.begin(),FS = FSizes.begin(); FN != FNames.end() && !Terminate; ++FN,++FS) { for(auto FN = FNames.begin(),FS = FSizes.begin(); FN != FNames.end() && !Terminate; ++FN,++FS) {
auto pos = FN->find_last_of('/'); auto pos = FN->find_last_of('/');
if (pos != std::string::npos) { if (pos != std::string::npos) {
@ -253,8 +252,7 @@ void SyncResources(SOCKET Sock){
Pos++; Pos++;
if (fs::exists(a)) { if (fs::exists(a)) {
if (FS->find_first_not_of("0123456789") != std::string::npos)continue; if (FS->find_first_not_of("0123456789") != std::string::npos)continue;
ModSize = std::stoull(*FS); if (fs::file_size(a) == std::stoull(*FS)){
if (fs::file_size(a) == ModSize){
UpdateUl(false,std::to_string(Pos) + "/" + std::to_string(Amount) + ": " + a.substr(a.find_last_of('/'))); UpdateUl(false,std::to_string(Pos) + "/" + std::to_string(Amount) + ": " + a.substr(a.find_last_of('/')));
std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::this_thread::sleep_for(std::chrono::milliseconds(50));
try { try {
@ -287,7 +285,7 @@ void SyncResources(SOCKET Sock){
std::string Name = std::to_string(Pos) + "/" + std::to_string(Amount) + ": " + FName; std::string Name = std::to_string(Pos) + "/" + std::to_string(Amount) + ": " + FName;
Data = MultiDownload(Sock,DSock,ModSize, Name); Data = MultiDownload(Sock,DSock,std::stoull(*FS), Name);
if(Terminate)break; if(Terminate)break;
UpdateUl(false,std::to_string(Pos)+"/"+std::to_string(Amount)+": "+FName); UpdateUl(false,std::to_string(Pos)+"/"+std::to_string(Amount)+": "+FName);
@ -298,7 +296,7 @@ void SyncResources(SOCKET Sock){
LFS.close(); LFS.close();
} }
}while(fs::file_size(a) != ModSize && !Terminate); }while(fs::file_size(a) != std::stoull(*FS) && !Terminate);
if(!Terminate){ if(!Terminate){
if(!fs::exists(GetGamePath() + L"mods/multiplayer")){ if(!fs::exists(GetGamePath() + L"mods/multiplayer")){
fs::create_directory(GetGamePath() + L"mods/multiplayer"); fs::create_directory(GetGamePath() + L"mods/multiplayer");

View File

@ -27,7 +27,7 @@ std::string GetVer(){
return "1.80"; return "1.80";
} }
std::string GetPatch(){ std::string GetPatch(){
return ".3"; return ".4";
} }
void ReLaunch(int argc,char*args[]){ void ReLaunch(int argc,char*args[]){
std::string Arg; std::string Arg;