rewrite
This commit is contained in:
Anonymous275
2020-08-21 20:58:10 +03:00
parent 232c4d7b28
commit 31c96cee94
59 changed files with 4247 additions and 1212 deletions

33
src/Init/Resources.cpp Normal file
View File

@@ -0,0 +1,33 @@
///
/// Created by Anonymous275 on 7/28/2020
///
#include "Security/Enc.h"
#include <filesystem>
#include "Settings.h"
#include <algorithm>
#include "Logger.h"
namespace fs = std::experimental::filesystem;
uint64_t MaxModSize = 0;
std::string FileSizes;
std::string FileList;
int ModsLoaded = 0;
void InitRes(){
std::string Path = Resource + Sec("/Client");
if(!fs::exists(Path))fs::create_directory(Path);
for (const auto & entry : fs::directory_iterator(Path)){
auto pos = entry.path().string().find(Sec(".zip"));
if(pos != std::string::npos){
if(entry.path().string().length() - pos == 4){
FileList += entry.path().string() + ";";
FileSizes += std::to_string(fs::file_size(entry.path()))+";";
MaxModSize += fs::file_size(entry.path());
ModsLoaded++;
}
}
}
std::replace(FileList.begin(),FileList.end(),'\\','/');
if(ModsLoaded){
info(Sec("Loaded ")+std::to_string(ModsLoaded)+Sec(" Mods"));
}
}