12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- //
- // Created by Иван_Архипов on 23.11.2017.
- //
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <ctime>
- #include <algorithm>
- #ifdef WIN32
- #include <direct.h>
- #define mkdir(dir, mode) _mkdir(dir)
- #endif
- #include "../LotroDatPatcher.h"
- #include "../Subfile.h"
- using namespace LOTRO_DAT;
- // Change these 2 variables to your path and name of .dat file
- const std::string path = "";//"E:\\SteamLibrary\\steamapps\\common\\";//Lord Of The Rings Online\\";
- const std::string filename = "client_local_English.dat";
- int main() {
- const clock_t begin_time = clock();
- freopen("errors.log", "w", stderr);
- //freopen("stdout.log", "w", stdout);
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
- setvbuf (stdout, NULL, _IONBF, BUFSIZ);
- setvbuf (stderr, NULL, _IONBF, BUFSIZ);
- Database db;
- db.InitDatabase("out.db");
- DatFile *a;
- try {
- a = new DatFile((path + filename).c_str(), 0);
- std::cout << "Starting magic...\n";
- std::cout << "Files number: " << a->files_number() << std::endl;
- a->WriteUnorderedDictionary("");
- a->PatchAllDatabase(&db);
- } catch (std::exception &e) {
- fprintf(stderr, "Caught %s exception.", e.what());
- printf("Caught %s exception.", e.what());
- fflush(stdout);
- printf("Some critical errors occured. Need to stop execution. See information in errors.log file");
- fprintf(stderr, "Some critical errors occured. Need to stop execution now...");
- }
- delete a;
- fprintf(stdout, "Spent %f seconds on performing magic! Thank you for your patience!\n",
- float(clock() - begin_time) / CLOCKS_PER_SEC);
- system("pause");
- return 0;
- }
|