| 33 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 | 
   | 
 #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 | 
   | 
 #include "boost/lexical_cast.hpp" //int -> string | 
 
 
 
 
 
 
 
 
 | 36 | 
 + | 
 #include "boost/algorithm/string.hpp" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 | 
   | 
 #include "installer.h" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 | 
   | 
 #ifdef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 65 | 
   | 
 using namespace std; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 68 | 
 + | 
 vector<string> globalInstalledMods; | 
 
 
 
 
 
 
 
 
 | 69 | 
 + | 
 vector<ModPackage> globalPackages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 71 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 72 | 
   | 
 #include "boost/date_time/gregorian/gregorian.hpp" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 77 | 
   | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 78 | 
   | 
         string output; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 79 | 
   | 
         string escape_me = "& ;()|<>\"'\\#*?$"; | 
 
 
 
 
 
 
 
 
 
 
 
 | 80 | 
 < | 
         for(int i = 0; i < input.size(); i++)  { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | 
 < | 
                 for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\'; | 
 
 
 
 
 
 
 
 
 
 | 80 | 
 > | 
         for(unsigned int i = 0; i < input.size(); i++)  { | 
 
 
 
 
 
 | 81 | 
 > | 
                 for(unsigned int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | 
   | 
                 output += input[i]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
   | 
         return output; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 334 | 
   | 
                 create_directory( VanillaSounds.parent_path() ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 335 | 
   | 
                 create_directory( VanillaAnimations.remove_filename() ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 336 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 337 | 
 < | 
                 for(int j = 0; j < GDFPaths.size(); j++) { | 
 
 
 
 
 
 
 
 
 
 | 337 | 
 > | 
                 for(unsigned int j = 0; j < GDFPaths.size(); j++) { | 
 
 
 
 
 
 
 
 
 
 
 
 | 338 | 
   | 
                         logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 339 | 
   | 
                         setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 340 | 
   | 
                         system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 411 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 412 | 
   | 
         try | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 413 | 
   | 
         { | 
 
 
 
 
 
 
 
 
 
 
 
 | 414 | 
 < | 
                 directory_iterator end_iter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 412 | 
 < | 
                 for (directory_iterator dir_itr("./packages"); dir_itr != end_iter; ++dir_itr) | 
 
 
 
 
 
 
 
 
 
 | 414 | 
 > | 
                 for (directory_iterator dir_itr("./packages"), end_itr; dir_itr != end_itr; ++dir_itr) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 415 | 
   | 
                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 416 | 
   | 
                         file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 417 | 
   | 
                         //cout << filename << "\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 490 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 491 | 
   | 
                         else if (!HasOnis.compare(*iter)) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 492 | 
   | 
                                 iter++; iter++;   | 
 
 
 
 
 
 
 
 
 
 
 
 | 493 | 
 < | 
                                 if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasOnis = 1; //Gotta love c++'s lack of a standard case-insensitive | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 494 | 
 < | 
                                 else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 495 | 
 < | 
                                         iter++; iter++;}  // using "YFR" would probably set it off. :< | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 496 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 497 | 
 < | 
                                 if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 493 | 
 > | 
                                 if ( boost::iequals(*iter, "Yes")) package.hasOnis = 1; | 
 
 
 
 
 
 | 494 | 
 > | 
                         }        | 
 
 
 
 
 
 | 495 | 
 > | 
                         else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment, | 
 
 
 
 
 
 | 496 | 
 > | 
                                 iter++; iter++;  // using "YFR" would probably set it off. :< | 
 
 
 
 
 
 | 497 | 
 > | 
                                 if ( boost::iequals(*iter, "Yes")) package.hasBSL = 1; | 
 
 
 
 
 
 | 498 | 
 > | 
                                 else if ( boost::iequals(*iter, "Addon")) package.hasAddon = 1; | 
 
 
 
 
 
 
 
 
 
 
 
 | 499 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 500 | 
   | 
                         else if (!HasDeltas.compare(*iter)) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 501 | 
   | 
                                 iter++; iter++;   | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 521 | 
   | 
                                                 //cout << " "; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 522 | 
   | 
                                                 package.category += *iter + " "; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 523 | 
   | 
                                         } | 
 
 
 
 
 
 
 
 
 
 | 521 | 
 – | 
                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 524 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 525 | 
 < | 
                         else if (!Creator.compare(*iter))  {    //if it contains the name | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 526 | 
 < | 
                                 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 527 | 
 < | 
                                         if (ARROW.compare(*iter) && Creator.compare(*iter)) {                   //ignores "->" and "Category" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 528 | 
 < | 
                                                 //cout << *iter;  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 529 | 
 < | 
                                                 //cout << " "; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 530 | 
 < | 
                                                 package.creator += *iter + " "; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 531 | 
 < | 
                                         } | 
 
 
 
 
 
 
 
 
 
 | 525 | 
 > | 
                 } | 
 
 
 
 
 
 | 526 | 
 > | 
                 else if (!Creator.compare(*iter))  {    //if it contains the name | 
 
 
 
 
 
 | 527 | 
 > | 
                         for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment | 
 
 
 
 
 
 | 528 | 
 > | 
                                 if (ARROW.compare(*iter) && Creator.compare(*iter)) {                   //ignores "->" and "Category" | 
 
 
 
 
 
 | 529 | 
 > | 
                                         //cout << *iter;  | 
 
 
 
 
 
 | 530 | 
 > | 
                                         //cout << " "; | 
 
 
 
 
 
 | 531 | 
 > | 
                                         package.creator += *iter + " "; | 
 
 
 
 
 
 
 
 
 
 
 
 | 532 | 
   | 
                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 533 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 534 | 
 < | 
                         else if (!Readme.compare(*iter))  {     //if it contains the name | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 535 | 
 < | 
                                 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 536 | 
 < | 
                                         if (ARROW.compare(*iter) && Readme.compare(*iter)) {                    //ignores "->" and "Category" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 537 | 
 < | 
                                                 if(!(*iter).compare("\\n")) package.readme += '\n'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 538 | 
 < | 
                                                 else package.readme += *iter + " "; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 539 | 
 < | 
                                         } | 
 
 
 
 
 
 
 
 
 
 | 534 | 
 > | 
                 } | 
 
 
 
 
 
 | 535 | 
 > | 
                 else if (!Readme.compare(*iter))  {     //if it contains the name | 
 
 
 
 
 
 | 536 | 
 > | 
                         for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment | 
 
 
 
 
 
 | 537 | 
 > | 
                                 if (ARROW.compare(*iter) && Readme.compare(*iter)) {                    //ignores "->" and "Category" | 
 
 
 
 
 
 | 538 | 
 > | 
                                         if(!(*iter).compare("\\n")) package.readme += '\n'; | 
 
 
 
 
 
 | 539 | 
 > | 
                                         else package.readme += *iter + " "; | 
 
 
 
 
 
 
 
 
 
 
 
 | 540 | 
   | 
                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 541 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 542 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 | 541 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 543 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 544 | 
 < | 
         package.doOutput(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 545 | 
 < | 
         return package; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 544 | 
 > | 
  | 
 
 
 
 
 
 | 545 | 
 > | 
 } | 
 
 
 
 
 
 | 546 | 
 > | 
 package.doOutput(); | 
 
 
 
 
 
 | 547 | 
 > | 
 return package; | 
 
 
 
 
 
 
 
 
 
 
 
 | 548 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 549 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 550 | 
   | 
 void recompileAll(vector<string> installedMods) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 614 | 
   | 
                                         if ( is_directory( dir_itr->status() ) &&  dir_itr.level() == 1) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 615 | 
   | 
                                         { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 616 | 
   | 
                                                 importCommand = strOniSplit + " " + strImportOption + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename(); | 
 
 
 
 
 
 
 
 
 
 
 
 | 617 | 
 < | 
                                                 for (int i = 0; i < installedMods.size(); ++i) { | 
 
 
 
 
 
 
 
 
 
 | 617 | 
 > | 
                                                 for (unsigned int i = 0; i < installedMods.size(); ++i) { | 
 
 
 
 
 
 
 
 
 
 
 
 | 618 | 
   | 
                                                         if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename()  )) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 619 | 
   | 
                                                                 importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 620 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 687 | 
   | 
                                 if ( is_directory( dir_itr->status() ) ) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 688 | 
   | 
                                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 689 | 
   | 
                                         importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " "; | 
 
 
 
 
 
 
 
 
 
 
 
 | 690 | 
 < | 
                                         for (int i = 0; i < installedMods.size(); ++i) { | 
 
 
 
 
 
 
 
 
 
 | 690 | 
 > | 
                                         for (unsigned int i = 0; i < installedMods.size(); ++i) { | 
 
 
 
 
 
 
 
 
 
 
 
 | 691 | 
   | 
                                                 if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename()  )) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 692 | 
   | 
                                                         importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 693 | 
   | 
                                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 714 | 
   | 
                                 logfile.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 715 | 
   | 
                         }} | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 716 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 | 717 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 718 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 719 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 720 | 
 + | 
          | 
 
 
 
 
 
 
 
 
 | 721 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 722 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 723 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 724 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 725 | 
 + | 
                 ofstream BSLlog("BSL.log"); | 
 
 
 
 
 
 
 
 
 | 726 | 
 + | 
                  | 
 
 
 
 
 
 
 
 
 | 727 | 
 + | 
                 vector<string> BSLfolders; | 
 
 
 
 
 
 
 
 
 | 728 | 
 + | 
                 vector<string> skippedfolders; | 
 
 
 
 
 
 
 
 
 | 729 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 730 | 
 + | 
                  | 
 
 
 
 
 
 
 
 
 | 731 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 732 | 
 + | 
                 for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr; | 
 
 
 
 
 
 
 
 
 | 733 | 
 + | 
                         dir_itr != end_itr; | 
 
 
 
 
 
 
 
 
 | 734 | 
 + | 
                         ++dir_itr ) { | 
 
 
 
 
 
 
 
 
 | 735 | 
 + | 
                                 if( exists(dir_itr->path().string() + "/ignore.txt") ){ | 
 
 
 
 
 
 
 
 
 | 736 | 
 + | 
                                         BSLfolders.push_back(dir_itr->path().filename()); | 
 
 
 
 
 
 
 
 
 | 737 | 
 + | 
                                         skippedfolders.push_back(dir_itr->path().filename()); | 
 
 
 
 
 
 
 
 
 | 738 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 739 | 
 + | 
                 } | 
 
 
 
 
 
 
 
 
 | 740 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 741 | 
 + | 
                 for (int i = installedMods.size() - 1; i >= 0; i--) {                                                   //Iterates through the installed mods (backwards :P) | 
 
 
 
 
 
 
 
 
 | 742 | 
 + | 
                         for (unsigned int j = 0; j < globalPackages.size(); ++j) {                              //looking in the global packages | 
 
 
 
 
 
 
 
 
 | 743 | 
 + | 
                                 if (globalPackages[j].modStringName == installedMods[i]) {      //for a mod that has BSL in it | 
 
 
 
 
 
 
 
 
 | 744 | 
 + | 
                                         BSLlog << "Testing " << globalPackages[j].modStringName << "\n" | 
 
 
 
 
 
 
 
 
 | 745 | 
 + | 
                                                 << "HasBSL: " << globalPackages[j].hasBSL << "\n" | 
 
 
 
 
 
 
 
 
 | 746 | 
 + | 
                                                 << "HasAddon: " << globalPackages[j].hasAddon << "\n"; | 
 
 
 
 
 
 
 
 
 | 747 | 
 + | 
                                         if(!(globalPackages[j].hasAddon || globalPackages[j].hasBSL)) break; //skip non-BSL | 
 
 
 
 
 
 
 
 
 | 748 | 
 + | 
                                         if( exists( "packages/" + globalPackages[j].modStringName + "/BSL" ) ) | 
 
 
 
 
 
 
 
 
 | 749 | 
 + | 
                                         copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); | 
 
 
 
 
 
 
 
 
 | 750 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 751 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 752 | 
 + | 
                         } | 
 
 
 
 
 
 
 
 
 | 753 | 
 + | 
                 } | 
 
 
 
 
 
 
 
 
 | 754 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 755 | 
 + | 
                 ModPackage emptyPackage; | 
 
 
 
 
 
 
 
 
 | 756 | 
 + | 
                 copyBSL("packages/VanillaBSL/IGMD", BSLfolders, emptyPackage); | 
 
 
 
 
 
 
 
 
 | 757 | 
 + | 
                 BSLlog.close(); | 
 
 
 
 
 
 
 
 
 | 758 | 
 + | 
          | 
 
 
 
 
 
 
 
 
 | 759 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 760 | 
   | 
         logfile << "Writing config file"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 761 | 
   | 
         writeInstalledMods(installedMods); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 762 | 
   | 
         setProgressBar(1000); | 
 
 
 
 
 
 
 
 
 
 
 
 | 763 | 
 < | 
         setStatusArea("Done! You can now play Oni."); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 763 | 
 > | 
          | 
 
 
 
 
 
 | 764 | 
 > | 
         string finallyDone = "Done! You can now play Oni."; | 
 
 
 
 
 
 | 765 | 
 > | 
          | 
 
 
 
 
 
 | 766 | 
 > | 
 a | 
 
 
 
 
 
 | 767 | 
 > | 
          | 
 
 
 
 
 
 | 768 | 
 > | 
         setStatusArea(finallyDone); | 
 
 
 
 
 
 
 
 
 
 
 
 | 769 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 770 | 
   | 
         ptime end_time(second_clock::local_time()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 771 | 
   | 
         time_period total_time (start_time, end_time); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 774 | 
   | 
         ofstream logfile2("Install.log", ios::app | ios::ate); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 775 | 
   | 
         string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 776 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 777 | 
 < | 
         logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); | 
 
 
 
 
 
 
 
 
 
 | 777 | 
 > | 
         logfile2 << "\nInstallation ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); | 
 
 
 
 
 
 
 
 
 
 
 
 | 778 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 779 | 
   | 
         //logfile2.write(outstring.c_str(), outstring.length()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 780 | 
   | 
         logfile2.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 783 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 784 | 
   | 
         Sleep(1000); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 785 | 
   | 
         setProgressBar(0); | 
 
 
 
 
 
 
 
 
 
 | 735 | 
 – | 
          | 
 
 
 
 
 
 
 
 
 
 | 736 | 
 – | 
 } | 
 
 
 
 
 
 
 
 
 
 | 737 | 
 – | 
                         catch(exception & ex) { | 
 
 
 
 
 
 
 
 
 
 | 738 | 
 – | 
                                         remove("Install.log"); | 
 
 
 
 
 
 
 
 
 
 | 739 | 
 – | 
                                         ofstream logfile("Install.log"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 786 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 787 | 
 + | 
         } | 
 
 
 
 
 
 
 
 
 | 788 | 
 + | 
         catch(exception & ex) { | 
 
 
 
 
 
 
 
 
 | 789 | 
 + | 
                 remove("Install.log"); //why did we do this? :| | 
 
 
 
 
 
 
 
 
 | 790 | 
 + | 
                 ofstream logfile("Install.log"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 791 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 792 | 
 < | 
                                         logfile << "Warning, exception " << ex.what() << "!"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 793 | 
 < | 
                                         setStatusArea("Warning, exception " + (string)ex.what() + "!"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 794 | 
 < | 
                                         logfile.close();         | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 795 | 
 < | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 796 | 
 < | 
                         busy = 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 792 | 
 > | 
  | 
 
 
 
 
 
 | 793 | 
 > | 
                 logfile << "Warning, exception " << ex.what() << "!"; | 
 
 
 
 
 
 | 794 | 
 > | 
                 setStatusArea("Warning, exception " + (string)ex.what() + "!"); | 
 
 
 
 
 
 | 795 | 
 > | 
                 logfile.close();         | 
 
 
 
 
 
 | 796 | 
 > | 
         } | 
 
 
 
 
 
 | 797 | 
 > | 
         busy = 0; | 
 
 
 
 
 
 
 
 
 
 
 
 | 798 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 799 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 800 | 
 + | 
 void copyBSL(string copypath, vector<string> BSLfolders, ModPackage pkg) { | 
 
 
 
 
 
 
 
 
 | 801 | 
 + | 
         try { | 
 
 
 
 
 
 
 
 
 | 802 | 
 + | 
                 for ( directory_iterator dir_itr( copypath ), end_itr; | 
 
 
 
 
 
 
 
 
 | 803 | 
 + | 
                         dir_itr != end_itr; | 
 
 
 
 
 
 
 
 
 | 804 | 
 + | 
                         ++dir_itr ) { | 
 
 
 
 
 
 
 
 
 | 805 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 806 | 
 + | 
                                 if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) {   | 
 
 
 
 
 
 
 
 
 | 807 | 
 + | 
                                         int skip_folder = 0; | 
 
 
 
 
 
 
 
 
 | 808 | 
 + | 
                                         for(unsigned int k = 0; k < BSLfolders.size(); k++)             {//iterate through already found BSL folders     | 
 
 
 
 
 
 
 
 
 | 809 | 
 + | 
                                                 if(dir_itr->path().filename() == BSLfolders[k]) { | 
 
 
 
 
 
 
 
 
 | 810 | 
 + | 
                                                         skip_folder = 1;                         | 
 
 
 
 
 
 
 
 
 | 811 | 
 + | 
                                                         break; | 
 
 
 
 
 
 
 
 
 | 812 | 
 + | 
                                                 } | 
 
 
 
 
 
 
 
 
 | 813 | 
 + | 
                                         } | 
 
 
 
 
 
 
 
 
 | 814 | 
 + | 
                                         if (!skip_folder && !exists("../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/ignore.txt")) { | 
 
 
 
 
 
 
 
 
 | 815 | 
 + | 
                                                 remove_all( "../GameDataFolder/IGMD/" + dir_itr->path().filename() ); | 
 
 
 
 
 
 
 
 
 | 816 | 
 + | 
                                                 Sleep(100); | 
 
 
 
 
 
 
 
 
 | 817 | 
 + | 
                                                 create_directory( "../GameDataFolder/IGMD/" + dir_itr->path().filename()); | 
 
 
 
 
 
 
 
 
 | 818 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 819 | 
 + | 
                                                 for ( directory_iterator bsl_itr( dir_itr->path() ); | 
 
 
 
 
 
 
 
 
 | 820 | 
 + | 
                                                         bsl_itr != end_itr; | 
 
 
 
 
 
 
 
 
 | 821 | 
 + | 
                                                         bsl_itr++ ) { | 
 
 
 
 
 
 
 
 
 | 822 | 
 + | 
                                                                 if ( bsl_itr->path().extension() == ".bsl" ) { | 
 
 
 
 
 
 
 
 
 | 823 | 
 + | 
                                                                         copy_file(bsl_itr->path(),  "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename());  | 
 
 
 
 
 
 
 
 
 | 824 | 
 + | 
                                                                 } | 
 
 
 
 
 
 
 
 
 | 825 | 
 + | 
                                                 } | 
 
 
 
 
 
 
 
 
 | 826 | 
 + | 
                                                 BSLfolders.push_back( dir_itr->path().filename() ); | 
 
 
 
 
 
 
 
 
 | 827 | 
 + | 
                                         } | 
 
 
 
 
 
 
 
 
 | 828 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 829 | 
 + | 
                 } | 
 
 
 
 
 
 
 
 
 | 830 | 
 + | 
         } | 
 
 
 
 
 
 
 
 
 | 831 | 
 + | 
         catch ( const std::exception & ex ) | 
 
 
 
 
 
 
 
 
 | 832 | 
 + | 
         { | 
 
 
 
 
 
 
 
 
 | 833 | 
 + | 
                 setStatusArea("Warning, exception " + (string)ex.what() + "!"); | 
 
 
 
 
 
 
 
 
 | 834 | 
 + | 
                 while(1) Sleep(1000); | 
 
 
 
 
 
 
 
 
 | 835 | 
 + | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 836 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 837 | 
 + | 
 } | 
 
 
 
 
 
 
 
 
 | 838 | 
 + | 
                           | 
 
 
 
 
 
 
 
 
 | 839 | 
 + | 
                           | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 840 | 
   | 
 void writeInstalledMods(vector<string> installedMods) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 841 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 842 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 918 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 919 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 920 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 831 | 
 – | 
 vector<string> globalInstalledMods; | 
 
 
 
 
 
 
 
 
 
 | 832 | 
 – | 
 vector<ModPackage> globalPackages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 921 | 
   | 
 #include "boost/thread.hpp" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 922 | 
   | 
 #include <boost/thread/mutex.hpp> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 923 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1291 | 
   | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1292 | 
   | 
         globalPackages = getPackages(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1293 | 
   | 
         globalInstalledMods = getInstallString(); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1294 | 
 < | 
         for (int i = 0; i < globalPackages.size(); i++) { | 
 
 
 
 
 
 
 
 
 
 | 1294 | 
 > | 
         for (unsigned int i = 0; i < globalPackages.size(); i++) { | 
 
 
 
 
 
 
 
 
 
 
 
 | 1295 | 
   | 
                 Mods_CheckboxList->Append(globalPackages[i].name.c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1296 | 
   | 
                 if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1297 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1330 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1331 | 
   | 
         switch(SelectAll->Get3StateValue()) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1332 | 
   | 
         case wxCHK_UNCHECKED: | 
 
 
 
 
 
 
 
 
 
 
 
 | 1333 | 
 < | 
                 for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); | 
 
 
 
 
 
 
 
 
 
 | 1333 | 
 > | 
                 for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1334 | 
   | 
                 //SelectAll->Set3StateValue(wxCHK_CHECKED); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1335 | 
   | 
                 break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1336 | 
   | 
         case wxCHK_CHECKED: | 
 
 
 
 
 
 
 
 
 
 
 
 | 1337 | 
 < | 
                 for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); | 
 
 
 
 
 
 
 
 
 
 | 1337 | 
 > | 
                 for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1338 | 
   | 
                 //SelectAll->Set3StateValue(wxCHK_UNCHECKED); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1339 | 
   | 
                 break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1340 | 
   | 
         case wxCHK_UNDETERMINED: | 
 
 
 
 
 
 
 
 
 
 
 
 | 1341 | 
 < | 
                 for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); | 
 
 
 
 
 
 
 
 
 
 | 1341 | 
 > | 
                 for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1342 | 
   | 
                 //SelectAll->Set3StateValue(wxCHK_CHECKED); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1343 | 
   | 
                 break; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1344 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1521 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1522 | 
   | 
         vector<string> localPackages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1523 | 
   | 
         localPackages.push_back("00000Globalize"); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1524 | 
 < | 
         for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); | 
 
 
 
 
 
 
 
 
 
 | 1524 | 
 > | 
         for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1525 | 
   | 
         if ( !localPackages.empty() )   { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1526 | 
   | 
                 sort(localPackages.begin(), localPackages.end()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1527 | 
   | 
                 localPackages[0] = "Globalize"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1663 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1664 | 
   | 
         Mods_CheckboxList->Clear(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1665 | 
   | 
         //globalInstalledMods = getPackages(); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1666 | 
 < | 
         for (int i = 0; i < globalPackages.size(); i++) { | 
 
 
 
 
 
 
 
 
 
 | 1666 | 
 > | 
         for (unsigned int i = 0; i < globalPackages.size(); i++) { | 
 
 
 
 
 
 
 
 
 
 
 
 | 1667 | 
   | 
                 Mods_CheckboxList->Append(globalPackages[i].name.c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1668 | 
   | 
                 if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1669 | 
   | 
                 //else Mods_CheckboxList->Check(i,0); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1726 | 
   | 
                 ofstream file(openFileDialog->GetPath().c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1727 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1728 | 
   | 
                 vector<string>list; | 
 
 
 
 
 
 
 
 
 
 
 
 | 1729 | 
 < | 
                 for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); | 
 
 
 
 
 
 
 
 
 
 | 1729 | 
 > | 
                 for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1730 | 
   | 
                 vector<string>::iterator begin_iter = list.begin();  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1731 | 
   | 
                 vector<string>::iterator end_iter = list.end(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1732 | 
   | 
  |