Skip to content

Commit

Permalink
Expose list items
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmine committed Mar 17, 2022
1 parent 4184f1b commit f87c6dc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/SerializableStringList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ namespace Celeste.Misc.Utils
{
public class SerializableStringList : IXmlSerializable
{
private IList<string> _items;
[XmlIgnore]
public IList<string> Items { get; private set; }

public SerializableStringList()
{
_items = new List<string>();
Items = new List<string>();
}

public SerializableStringList(IList<string> items)
{
_items = items;
Items = items;
}

public SerializableStringList(string str)
{
_items = Parse(str);
Items = Parse(str);
}

public XmlSchema GetSchema() => null;

public void ReadXml(XmlReader reader)
{
_items = Parse(reader.ReadString());
Items = Parse(reader.ReadString());
}

private IList<string> Parse(string value)
Expand All @@ -42,9 +43,9 @@ private IList<string> Parse(string value)

public void WriteXml(XmlWriter writer)
{
writer.WriteString(_items.ToStringList());
writer.WriteString(Items.ToStringList());
}

public string SerializeList() => _items.ToStringList();
public string SerializeList() => Items.ToStringList();
}
}

0 comments on commit f87c6dc

Please sign in to comment.