public void CreateGroupAt(Qualities4 find, int groupId, string name, Qualities4[] qualities) { foreach (var profile in _profiles) { var findIndex = profile.Items.FindIndex(v => v.Quality == (int)find); if (findIndex > -1) { var findQuality = profile.Items[findIndex]; profile.Items.Insert(findIndex, new ProfileItem4 { Id = groupId, Name = name, Quality = null, Items = qualities.Select(q => new ProfileItem4 { Quality = (int)q, Allowed = findQuality.Allowed }).ToList(), Allowed = findQuality.Allowed }); } else { // If the ID isn't found for some reason (mangled migration 71?) profile.Items.Add(new ProfileItem4 { Id = groupId, Name = name, Quality = null, Items = qualities.Select(q => new ProfileItem4 { Quality = (int)q, Allowed = false }).ToList(), Allowed = false }); } foreach (var quality in qualities) { var index = profile.Items.FindIndex(v => v.Quality == (int)quality); if (index > -1) { profile.Items.RemoveAt(index); } if (profile.Cutoff == (int)quality) { profile.Cutoff = groupId; } } _changedProfiles.Add(profile); } }
public void AddQuality(Qualities4 quality) { foreach (var profile in _profiles) { profile.Items.Add(new ProfileItem4 { Quality = (int)quality, Allowed = false }); } }
public void MoveQuality(Qualities4 quality, Qualities4 moveafter) { foreach (var profile in _profiles) { var findIndex = profile.Items.FindIndex(v => v.Quality == (int)quality); if (findIndex > -1) { var allowed = profile.Items[findIndex].Allowed; profile.Items.RemoveAt(findIndex); var findMoveIndex = profile.Items.FindIndex(v => v.Quality == (int)moveafter) + 1; profile.Items.Insert(findMoveIndex, new ProfileItem4 { Quality = (int)quality, Allowed = allowed }); } } }
public void CreateNewGroup(Qualities4 createafter, int groupId, string name, Qualities4[] qualities) { foreach (var profile in _profiles) { var findIndex = profile.Items.FindIndex(v => v.Quality == (int)createafter) + 1; if (findIndex > -1) { profile.Items.Insert(findIndex, new ProfileItem4 { Id = groupId, Name = name, Quality = null, Items = qualities.Select(q => new ProfileItem4 { Quality = (int)q, Allowed = false }).ToList(), Allowed = false }); } else { profile.Items.Add(new ProfileItem4 { Id = groupId, Name = name, Quality = null, Items = qualities.Select(q => new ProfileItem4 { Quality = (int)q, Allowed = false }).ToList(), Allowed = false }); } } }