private static bool Set(Rom rom, List <RomLabel> selected, List <RomLabel> unselected) { List <string> updatedlabels = new List <string>(); if (rom.RomLabels != null) { foreach (var label in rom.RomLabels.Labels) { updatedlabels.Add(label); } } if (selected != null) { foreach (var s in selected) { if (!updatedlabels.Any(x => x == s.Name)) { updatedlabels.Add(s.Name); } } } if (unselected != null) { foreach (var u in unselected) { if (updatedlabels.Any(x => x == u.Name)) { updatedlabels.Remove(u.Name); } } } SetNode(rom.Platform.Name, rom.FileName, updatedlabels); var labels = new List <string>(); foreach (var label in updatedlabels) { labels.Add(label); } var romlabels = new RomLabels(rom.Platform.Name, rom.FileName, labels); romLabelsList.Remove(romlabels.Key); romLabelsList.Add(romlabels.Key, romlabels); rom.RomLabels = romlabels; return(true); }
public static void Fill() { romLabelsList = new Dictionary <string, RomLabels>(); foreach (XmlNode node in XML.GetRomLabelsNodes()) { var labels = new List <string>(); foreach (XmlNode nodelabels in node.ChildNodes[0].ChildNodes) { labels.Add(nodelabels.InnerText); } RomLabels romLabels = new RomLabels(node.Attributes["Platform"].Value, node.Attributes["Rom"].Value, labels); romLabelsList.Add(romLabels.Key, romLabels); } }