private void UpdateModsView() { ILocalModsView.Items.Clear(); var localMods = LocalMod.GetLocalMods(); var serverPathMods = LocalMod.GetLocalMods(true); var steamMods = SteamMod.GetSteamMods(); var modsToRemove = (from localMod in serverPathMods from steamMod in steamMods where localMod.Name == Functions.SafeName(steamMod.Name) select localMod).ToList(); foreach (var remove in modsToRemove) { try { serverPathMods.RemoveAt(serverPathMods.IndexOf(serverPathMods.Find(m => m.Name == remove.Name))); } catch (ArgumentOutOfRangeException) { /*IGNORED*/ } } localMods.AddRange(serverPathMods); if (localMods.Count <= 0) { return; } foreach (var localMod in localMods) { ILocalModsView.Items.Add(localMod); } }
private void UpdateModsView() { ILocalModsView.Items.Clear(); var localMods = LocalMod.GetLocalMods(); var serverPathMods = LocalMod.GetLocalMods(true); var steamMods = SteamMod.GetSteamMods(); var modsToRemove = new List <LocalMod>(); foreach (LocalMod localMod in serverPathMods) { foreach (SteamMod steamMod in steamMods) { if (localMod.Name == Functions.SafeName(steamMod.Name)) { modsToRemove.Add(localMod); } } } foreach (var remove in modsToRemove) { serverPathMods.RemoveAt(serverPathMods.IndexOf(serverPathMods.Find(m => m.Name == remove.Name))); } localMods.AddRange(serverPathMods); if (localMods.Count > 0) { foreach (var localMod in localMods) { ILocalModsView.Items.Add(localMod); } } }