1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // 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"
- 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";
- const std::string patch_filename = "image.jpg";
- const int file_id = 0;
- int main() {
- const clock_t begin_time = clock();
- freopen("errors.log", "w", stderr);
- Database db;
- db.InitDatabase("images.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("");
- SubfileData data = db.GetNextFile();
- while (data != SubfileData()) {
- //binary_data.ReadFromFile("1090552107.jpg");
- //options["fid"] = "1090552107";
- //options["ext"] = ".jpg";
- a->PatchFile(data);
- data = db.GetNextFile();
- //delete a;
- }
- } 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;
- }
|