private void parseMetaCmm(bool disabled, bool modNamePrefersTPMI) { DLCFolderNameString = DLCFolderName.TrimStart('x'); //this string is not to show M3L.GetString(M3L.string_disabled) var metaFile = Path.Combine(dlcFolderPath, @"_metacmm.txt"); if (File.Exists(metaFile)) { InstalledByManagedSolution = true; InstalledBy = M3L.GetString(M3L.string_installedByModManager); //Default value when finding metacmm. MetaCMM mcmm = new MetaCMM(metaFile); if (DLCFolderNameString != ModName && mcmm.ModName != ModName) { DLCFolderNameString += $@" ({ModName})"; if (!modNamePrefersTPMI || ModName == null) { ModName = mcmm.ModName; } } ModName = mcmm.ModName; Version = mcmm.Version; InstallerInstanceBuild = mcmm.InstalledBy; if (int.TryParse(InstallerInstanceBuild, out var _)) { InstalledBy = M3L.GetString(M3L.string_installedByModManager); } else { InstalledBy = M3L.GetString(M3L.string_interp_installedByX, InstallerInstanceBuild); } // MetaCMM Extended if (mcmm.OptionsSelectedAtInstallTime != null) { ChosenInstallOptions.ReplaceAll(mcmm.OptionsSelectedAtInstallTime); } if (mcmm.IncompatibleDLC != null) { IncompatibleDLC.ReplaceAll(mcmm.IncompatibleDLC); } } else { InstalledBy = M3L.GetString(M3L.string_notInstalledByModManager); } if (disabled) { DLCFolderNameString += @" - " + M3L.GetString(M3L.string_disabled); } }
public InstalledDLCMod(string dlcFolderPath, Mod.MEGame game, Func <InstalledDLCMod, bool> deleteConfirmationCallback, Action notifyDeleted, bool modNamePrefersTPMI) { this.dlcFolderPath = dlcFolderPath; this.game = game; DLCFolderName = DLCFolderNameString = Path.GetFileName(dlcFolderPath); if (App.ThirdPartyIdentificationService[game.ToString()].TryGetValue(DLCFolderName.TrimStart('x'), out var tpmi)) { ModName = tpmi.modname; } else { ModName = DLCFolderName; } parseInstalledBy(DLCFolderName.StartsWith('x'), modNamePrefersTPMI); this.deleteConfirmationCallback = deleteConfirmationCallback; this.notifyDeleted = notifyDeleted; DeleteCommand = new RelayCommand(DeleteDLCMod, CanDeleteDLCMod); EnableDisableCommand = new GenericCommand(ToggleDLC, CanToggleDLC); }
private void ToggleDLC() { var source = dlcFolderPath; var dlcdir = Directory.GetParent(dlcFolderPath).FullName; var newdlcname = DLCFolderName.StartsWith(@"xDLC") ? DLCFolderName.TrimStart('x') : @"x" + DLCFolderName; var target = Path.Combine(dlcdir, newdlcname); try { Directory.Move(source, target); DLCFolderName = newdlcname; dlcFolderPath = target; } catch (Exception e) { Log.Error(@"Unable to toggle DLC: " + e.Message); } //TriggerPropertyChangedFor(nameof(DLCFolderName)); }
private void ToggleDLC() { var source = dlcFolderPath; var dlcdir = Directory.GetParent(dlcFolderPath).FullName; var isBecomingDisabled = DLCFolderName.StartsWith(@"DLC"); //about to change to xDLC, so it's becoming disabled var newdlcname = DLCFolderName.StartsWith(@"xDLC") ? DLCFolderName.TrimStart('x') : @"x" + DLCFolderName; var target = Path.Combine(dlcdir, newdlcname); try { Directory.Move(source, target); DLCFolderName = newdlcname; dlcFolderPath = target; EnableDisableTooltip = M3L.GetString(isBecomingDisabled ? M3L.string_tooltip_enableDLC : M3L.string_tooltip_disableDLC); } catch (Exception e) { Log.Error(@"Unable to toggle DLC: " + e.Message); } //TriggerPropertyChangedFor(nameof(DLCFolderName)); }
private bool CanToggleDLC() => (game == MEGame.ME3 || DLCFolderName.StartsWith('x')) && !Utilities.IsGameRunning(game);
public void OnDLCFolderNameChanged() { dlcFolderPath = Path.Combine(Directory.GetParent(dlcFolderPath).FullName, DLCFolderName); parseMetaCmm(DLCFolderName.StartsWith('x'), false); TriggerPropertyChangedFor(nameof(TextColor)); }