Skip to content

Commit

Permalink
Merge pull request #29 from KizKizz/backend-rework
Browse files Browse the repository at this point in the history
part2 bug fix
  • Loading branch information
KizKizz authored Jul 18, 2022
2 parents 8983f09 + c4ed3bc commit 9f39116
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 22 deletions.
5 changes: 2 additions & 3 deletions app_version_check/app_version.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "PSO2NGS Mod Manager",
"version": "1.4.1",
"version": "1.4.2",
"description": [
"Added a new refresh list button (near search bar)",
"Fixed a bug when applying duplicated mods",
"Fixed a bug when applying duplicated mods - part 2",
"Minor bug fixes"
],
"windows_file": "",
Expand Down
68 changes: 51 additions & 17 deletions lib/file_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Future<void> modsToDataAdder(List<ModFile> modList) async {
File(checkSumFilePath!).copySync('$binDirPath${s}data${s}win32$s${checkSumFilePath!.split(s).last}');
}

//Bulk apply
if (modList.length > 1) {
for (var modFile in modList) {
await Future(
Expand Down Expand Up @@ -134,17 +135,35 @@ Future<void> modsToDataAdder(List<ModFile> modList) async {
//check for dub applied mod
//set backup path to file
modFile.backupIcePath = '$backupDirPath$s${modFile.iceName}';
for (var lists in modFilesList) {
List<ModFile> matchingList = lists.where((element) => element.iceName == modFile.iceName && element.isApplied == true).toList();
if (matchingList.isNotEmpty) {
duplicateModsApplied.add(matchingList);
// for (var lists in modFilesList) {
// List<ModFile> matchingList = lists.where((element) => element.iceName == modFile.iceName && element.isApplied == true).toList();
// if (matchingList.isNotEmpty) {
// duplicateModsApplied.add(matchingList);

// if (appliedModsList.isNotEmpty) {
// for (var mod in matchingList) {
// for (var appliedList in appliedModsList) {
// appliedList.firstWhere((element) => element.iceName == mod.iceName).isApplied = false;
// appliedList.remove(mod);
// }
// mod.isApplied = false;
// mod.appliedDate = '';
// }
// appliedModsList.removeWhere((element) => element.isEmpty);
// }
// }
// }
// }

for (var file in allModFiles) {
if (file.iceName == modFile.iceName && file.isApplied) {
duplicateModsApplied.add([file]);

if (appliedModsList.isNotEmpty) {
for (var mod in matchingList) {
for (var appliedList in appliedModsList) {
appliedList.remove(mod);
}
for (var appliedList in appliedModsList) {
appliedList.remove(file);
}

appliedModsList.removeWhere((element) => element.isEmpty);
}
}
Expand Down Expand Up @@ -178,6 +197,8 @@ Future<void> modsToDataAdder(List<ModFile> modList) async {
element.isApplied = false;
}
}

//Single apply
} else {
for (var modFile in modList) {
//Backup file check and apply
Expand Down Expand Up @@ -205,18 +226,31 @@ Future<void> modsToDataAdder(List<ModFile> modList) async {
//check for dub applied mod
//set backup path to file
modFile.backupIcePath = '$backupDirPath$s${modFile.iceName}';
for (var lists in modFilesList) {
List<ModFile> matchingList =
lists.where((element) => (element.iceName == modFile.iceName || element.modName == modFile.modName) && element.isApplied == true).toList();
if (matchingList.isNotEmpty) {
duplicateModsApplied.add(matchingList);
// for (var lists in modFilesList) {
// List<ModFile> matchingList = lists.where((element) => (element.iceName == modFile.iceName) && element.isApplied == true).toList();
// if (matchingList.isNotEmpty) {
// duplicateModsApplied.add(matchingList);

// if (appliedModsList.isNotEmpty) {
// for (var mod in matchingList) {
// for (var appliedList in appliedModsList) {
// appliedList.remove(mod);
// }
// }
// appliedModsList.removeWhere((element) => element.isEmpty);
// }
// }
// }

for (var file in allModFiles) {
if (file.iceName == modFile.iceName && file.isApplied) {
duplicateModsApplied.add([file]);

if (appliedModsList.isNotEmpty) {
for (var mod in matchingList) {
for (var appliedList in appliedModsList) {
appliedList.remove(mod);
}
for (var appliedList in appliedModsList) {
appliedList.remove(file);
}

appliedModsList.removeWhere((element) => element.isEmpty);
}
}
Expand Down
4 changes: 2 additions & 2 deletions windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#else
#define VERSION_AS_NUMBER 1,4,1
#define VERSION_AS_NUMBER 1,4,2
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "1.4.1"
#define VERSION_AS_STRING "1.4.2"
#endif

VS_VERSION_INFO VERSIONINFO
Expand Down

0 comments on commit 9f39116

Please sign in to comment.