void IXmlSerializable.WriteXml(XmlWriter writer) { writer.WriteStartElement("StateMachineHistory"); int cursor = 0; int num2 = this.history.Count; while (cursor < num2) { string str = this.ReadState(ref cursor); writer.WriteStartElement("state"); writer.WriteAttributeString("name", str); while (true) { StringCount count = this.ReadEvent(ref cursor); if (count.Name == null) { break; } for (int i = 0; i < count.Count; i++) { writer.WriteStartElement("event"); writer.WriteAttributeString("name", count.Name); writer.WriteEndElement(); } } writer.WriteEndElement(); } writer.WriteEndElement(); }
public override string ToString() { int num = this.history.Count; if (num == 0) { return(string.Empty); } StringBuilder builder = new StringBuilder(); int cursor = 0; while (cursor < num) { string str = this.ReadState(ref cursor); builder.Append("["); builder.Append(str); builder.AppendLine("]"); while (true) { StringCount count = this.ReadEvent(ref cursor); if (count.Name != null) { for (int i = 0; i < count.Count; i++) { builder.Append("\t{"); builder.Append(count.Name); builder.AppendLine("}"); } } } } return(builder.ToString()); }
public void AddEvent(string newEvent) { int num = this.history.Count; if (num > 0) { StringCount count = this.history[num - 1]; if (count.Name == newEvent) { count.Count++; this.history[num - 1] = count; return; } } this.history.Add(new StringCount(newEvent)); }
static StringCount() { nullCount = new StringCount(null); }