public override DataItem LoadData(XElement element, UndoRedoManager undoRedo) { var item = new MultilineStringItem(this, undoRedo); if (ElementPerLine) { item.Value = string.Join(Seperator, element.Elements().Select((e) => e.Value.ToString())); } else { item.Value = element.Value; } foreach (var att in Attributes) { var el = element.Attribute(att.Name); DataItem attItem = null; if (el != null) { attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo); } else { attItem = att.CreateData(undoRedo); } item.Attributes.Add(attItem); } return(item); }
public override DataItem LoadData(XElement element, UndoRedoManager undoRedo) { var item = new MultilineStringItem(this, undoRedo); if (ElementPerLine) { item.Value = string.Join(Seperator, element.Elements().Select((e) => e.Value.ToString())); } else { if (NeedsLocalisation) { var id = element.Value; try { item.LocalisationID = id; item.Value = Localisation.GetLocalisation(LocalisationFile, id); } catch (Exception) { // fallback to assuming the text was in the element item.LocalisationID = null; item.Value = id; } } else { item.Value = element.Value; } } foreach (var att in Attributes) { var el = element.Attribute(att.Name); DataItem attItem = null; if (el != null) { attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo); } else { attItem = att.CreateData(undoRedo); } item.Attributes.Add(attItem); } return(item); }
public override DataItem CreateData(UndoRedoManager undoRedo) { var item = new MultilineStringItem(this, undoRedo); item.Value = Default; foreach (var att in Attributes) { var attItem = att.CreateData(undoRedo); item.Attributes.Add(attItem); } return(item); }