public void ToAml(XmlWriter writer, AmlWriterSettings settings) { writer.WriteStartElement("Item"); writer.WriteAttributeString("type", Type); writer.WriteAttributeString("id", Id); writer.WriteAttributeString("action", "edit"); writer.WriteAttributeString("doGetItem", "0"); writer.WriteElementString("x", _context.Format(Position.X)); writer.WriteElementString("y", _context.Format(Position.Y)); if (Segments.Any()) { writer.WriteElementString("segments", Segments.GroupConcat("|", p => $"{p.X},{p.Y}")); } writer.WriteEndElement(); }