public void AddOrUpdate(string prop, ref SortedBindingList <StringObject> strings, StringObject stringObject) { foreach (StringObject stringItem in strings) { if (stringItem.Id == stringObject.Id) { // SecurityElement.Escape(stringNode.Attributes["text"].InnerText) // No escape value stringItem.SetData(prop, new MixedValue(stringObject.GetType().GetProperty(prop).GetValue(stringObject, null))); return; } } strings.Add(stringObject); }
public void GetListStringData(string prop, ref SortedBindingList <StringObject> strings) { XmlNodeList li = node.SelectNodes("strings"); foreach (XmlNode item in li) { foreach (XmlNode stringNode in item.SelectNodes("string")) { int index = strings.Count; StringObject stringObject = new StringObject( index, stringNode.Attributes["id"].InnerText ); string originProp = "Origin" + prop; string text = stringNode.Attributes["text"].InnerText.ToString(); stringObject.SetData(prop, new MixedValue(text)); stringObject.SetData(originProp, new MixedValue(text)); AddOrUpdate(prop, ref strings, stringObject); } } }