private void RemoveModPack(TroveModPackViewModel currentItem) { log.InfoFormat("Removing mod pack: {0}", currentItem.DataObject.Name); foreach (var mod in MyMods.Where(m => m.ModPack == currentItem)) { mod.ModPack = null; mod.DataObject.PackName = null; } ModPacks.Remove(currentItem); }
private void SaveModPack(string modPackName) { bool newPack = false; if (string.IsNullOrEmpty(modPackName)) { log.Warn("No mod pack name specified to save"); return; } log.InfoFormat("Saving enabled standalone mods as mod pack {0}", modPackName); TroveModPackViewModel pack = ModPacks.FirstOrDefault(p => p.DataObject.Name == modPackName && p.DataObject.Source == TroveModPack.LocalSource); if (pack == null) { pack = new TroveModPackViewModel(new TroveModPack()); pack.DataObject.Name = modPackName; newPack = true; } else { pack.DataObject.Mods.Clear(); } foreach (var mod in MyMods.Where(m => m.DataObject.Enabled && m.ModPack == null)) { if (string.IsNullOrEmpty(mod.DataObject.Id)) { log.WarnFormat("Only mods downloaded from Trovesaurus can be included in mod packs, skipping mod: {0}", mod.DisplayName); continue; } mod.ModPack = pack; mod.DataObject.PackName = modPackName; pack.DataObject.Mods.Add(mod.DataObject); } if (pack.DataObject.Mods.Count > 0) { if (newPack) { ModPacks.Add(pack); } ModPacksView.MoveCurrentTo(pack); } else { log.ErrorFormat("No enabled standalone mods from Trovesaurus were added to mod pack {0}", modPackName); } }
private void UninstallAllMods(object param = null) { try { log.Info("Uninstalling all mods"); foreach (dynamic mod in MyMods.Where(m => m.DataObject.Enabled)) { mod.Enabled = false; } TroveMod.RemoveModFolders(); } catch (Exception ex) { log.Error("Error uninstalling all mods", ex); } }