| 1004 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1005 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1006 |  | } | 
 
 
 
 
 
 
 
 | 1007 | + | else | 
 
 
 
 
 
 
 
 | 1008 | + | { | 
 
 
 
 
 
 
 
 | 1009 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1010 | + | continue; | 
 
 
 
 
 
 
 
 | 1011 | + | } | 
 
 
 
 
 
 
 
 | 1012 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1013 | + |  | 
 
 
 
 
 
 
 
 | 1014 | + | file.open( ("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 | 1015 | + | if (!file.fail()) | 
 
 
 
 
 
 
 
 | 1016 | + | { | 
 
 
 
 
 
 
 
 | 1017 | + | ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); | 
 
 
 
 
 
 
 
 | 1018 | + | } | 
 
 
 
 
 
 
 
 | 1019 | + | else | 
 
 
 
 
 
 
 
 | 1020 | + | { | 
 
 
 
 
 
 
 
 | 1021 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1022 | + | return UPDATE_THIRD_PARTY; | 
 
 
 
 
 
 
 
 | 1023 | + | } | 
 
 
 
 
 
 
 
 | 1024 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1025 | + | if(((string)INSTALLER_VERSION).compare(updatePackage.installerVersion) < 1 && updatePackage.modStringVersion > installedPackage.modStringVersion) { | 
 
 
 
 
 
 
 
 | 1026 | + | return UPDATE_THIRD_PARTY; | 
 
 
 
 
 
 
 
 | 1027 | + | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1028 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1029 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1030 |  | catch (exception & ex) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1286 |  | return true; // returning 'true' tells the Installer to quit itself ASAP so it can be replaced by the process that is now running | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1287 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1288 |  |  | 
 
 
 
 
 
 
 
 | 1289 | + |  | 
 
 
 
 
 
 
 
 | 1290 | + | void CrawlPackages(string pathToUpdate, string strPathToPackages) { | 
 
 
 
 
 
 
 
 | 1291 | + | try{ | 
 
 
 
 
 
 
 
 | 1292 | + | directory_iterator end; | 
 
 
 
 
 
 
 
 | 1293 | + | for ( directory_iterator update_iter( pathToUpdate ); | 
 
 
 
 
 
 
 
 | 1294 | + | update_iter != end; | 
 
 
 
 
 
 
 
 | 1295 | + | ++update_iter ) | 
 
 
 
 
 
 
 
 | 1296 | + | { | 
 
 
 
 
 
 
 
 | 1297 | + |  | 
 
 
 
 
 
 
 
 | 1298 | + | ModPackage installedPackage, updatePackage; | 
 
 
 
 
 
 
 
 | 1299 | + | string updateStr = update_iter->path().string() + "/Mod_Info.cfg"; | 
 
 
 
 
 
 
 
 | 1300 | + | if ( !boost::iequals(update_iter->path().filename(),"Edition") | 
 
 
 
 
 
 
 
 | 1301 | + | && !boost::iequals(update_iter->path().filename(),"Edition-patch") | 
 
 
 
 
 
 
 
 | 1302 | + | && is_directory( update_iter->path() ) | 
 
 
 
 
 
 
 
 | 1303 | + | && exists( update_iter->path().string() + "/Mod_Info.cfg" ) ) | 
 
 
 
 
 
 
 
 | 1304 | + | { | 
 
 
 
 
 
 
 
 | 1305 | + | bool update = 0; | 
 
 
 
 
 
 
 
 | 1306 | + | fstream file; | 
 
 
 
 
 
 
 
 | 1307 | + | file.open( (update_iter->path().string() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 | 1308 | + | if (!file.fail()) | 
 
 
 
 
 
 
 
 | 1309 | + | { | 
 
 
 
 
 
 
 
 | 1310 | + | updatePackage = fileToModPackage(file, update_iter->path().filename()); | 
 
 
 
 
 
 
 
 | 1311 | + | } | 
 
 
 
 
 
 
 
 | 1312 | + | else | 
 
 
 
 
 
 
 
 | 1313 | + | { | 
 
 
 
 
 
 
 
 | 1314 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1315 | + | continue; | 
 
 
 
 
 
 
 
 | 1316 | + | } | 
 
 
 
 
 
 
 
 | 1317 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1318 | + | file.clear(); | 
 
 
 
 
 
 
 
 | 1319 | + | if(exists(strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg")) | 
 
 
 
 
 
 
 
 | 1320 | + | { | 
 
 
 
 
 
 
 
 | 1321 | + | file.open((strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 | 1322 | + | if (!file.fail()) | 
 
 
 
 
 
 
 
 | 1323 | + | { | 
 
 
 
 
 
 
 
 | 1324 | + | installedPackage = fileToModPackage(file, update_iter->path().filename()); | 
 
 
 
 
 
 
 
 | 1325 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1326 | + | if(updatePackage.modStringVersion > installedPackage.modStringVersion) { | 
 
 
 
 
 
 
 
 | 1327 | + | update = 1; | 
 
 
 
 
 
 
 
 | 1328 | + | } | 
 
 
 
 
 
 
 
 | 1329 | + | } | 
 
 
 
 
 
 
 
 | 1330 | + | else | 
 
 
 
 
 
 
 
 | 1331 | + | { | 
 
 
 
 
 
 
 
 | 1332 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1333 | + | update = 1; | 
 
 
 
 
 
 
 
 | 1334 | + | } | 
 
 
 
 
 
 
 
 | 1335 | + | file.close(); | 
 
 
 
 
 
 
 
 | 1336 | + | } | 
 
 
 
 
 
 
 
 | 1337 | + | else update = 1; | 
 
 
 
 
 
 
 
 | 1338 | + | if(update) { | 
 
 
 
 
 
 
 
 | 1339 | + | if(exists((path)(strPathToPackages +  "/" + updatePackage.modStringName))) | 
 
 
 
 
 
 
 
 | 1340 | + | remove_all((path)(strPathToPackages +  "/" + updatePackage.modStringName)); | 
 
 
 
 
 
 
 
 | 1341 | + | rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName)); | 
 
 
 
 
 
 
 
 | 1342 | + |  | 
 
 
 
 
 
 
 
 | 1343 | + | } | 
 
 
 
 
 
 
 
 | 1344 | + | } | 
 
 
 
 
 
 
 
 | 1345 | + | } | 
 
 
 
 
 
 
 
 | 1346 | + | } | 
 
 
 
 
 
 
 
 | 1347 | + | catch (exception & ex) { | 
 
 
 
 
 
 
 
 | 1348 | + | //      ex.what(); | 
 
 
 
 
 
 
 
 | 1349 | + | setStatusArea("Warning, handled exception: " + (string)ex.what()); | 
 
 
 
 
 
 
 
 | 1350 | + | } | 
 
 
 
 
 
 
 
 | 1351 | + | } | 
 
 
 
 
 
 
 
 | 1352 | + |  | 
 
 
 
 
 
 
 
 | 1353 | + |  | 
 
 
 
 
 
 
 
 | 1354 | + | bool ProcessThirdPartyUpdates() { | 
 
 
 
 
 
 
 
 | 1355 | + | CrawlPackages( "../updates",  "./packages"); | 
 
 
 
 
 
 
 
 | 1356 | + | return true; | 
 
 
 
 
 
 
 
 | 1357 | + | //      globalPackages = getPackages(); | 
 
 
 
 
 
 
 
 | 1358 | + | //      refreshMods(globalInstalledMods); | 
 
 
 
 
 
 
 
 | 1359 | + | } | 
 
 
 
 
 
 
 
 | 1360 | + |  | 
 
 
 
 
 
 
 
 | 1361 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1362 |  | bool ProcessAEUpdate(Install_info_cfg *currentAE, Install_info_cfg *updateAE, bool *installerJustUpdated) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1363 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1364 |  | fstream file; |