1234567891011121314151617181920212223242526272829303132 |
- using System.IO;
- using System.Text;
- using System.Xml;
- namespace AIPractice.Shared.Labels
- {
- public class DescriptionLabel: ImageLabel
- {
- public DescriptionLabel(string id, string title) : base(id, title)
- {
- }
- public static DescriptionLabel FromXml(string xmlContent)
- {
- using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(xmlContent)))
- {
- using (var r = XmlReader.Create(ms))
- {
- r.Read();
- var id = r.GetAttribute("id");
- var title = r.GetAttribute("title");
- return new DescriptionLabel(id, title);
- }
- }
- }
- public override string ToXml()
- {
- return $"<{nameof(DescriptionLabel)} id=\"{Id}\" title=\"{Title}\"/>";
- }
- }
- }
|