public override string ToString() { switch (Mode_) { case Mode.Position: return(Position.ToString()); case Mode.PreparePosition: return(PreparePosition.ToString()); case Mode.Stream: return(Streams.Keys.First() + ": " + Streams.Values.First()); case Mode.MultiStream: case Mode.EventTypeIndex: var sb = new StringBuilder(); if (Mode_ == Mode.EventTypeIndex) { sb.Append(Position.ToString()); sb.Append("; "); } foreach (var stream in Streams) { sb.AppendFormat("{0}: {1}; ", stream.Key, stream.Value); } return(sb.ToString()); default: return("Unsupported mode: " + base.ToString()); } }
public override string ToString() { string result; switch (Mode_) { case Mode.Phase: return("Phase: " + Phase + (Completed ? " (completed)" : "")); case Mode.Position: result = Position.ToString(); break; case Mode.PreparePosition: result = PreparePosition.ToString(); break; case Mode.Stream: result = Streams.Keys.First() + ": " + Streams.Values.First(); break; case Mode.MultiStream: case Mode.EventTypeIndex: var sb = new StringBuilder(); if (Mode_ == Mode.EventTypeIndex) { sb.Append(Position.ToString()); sb.Append("; "); } foreach (var stream in Streams) { sb.AppendFormat("{0}: {1}; ", stream.Key, stream.Value); } result = sb.ToString(); break; case Mode.ByStream: result = string.Format( "{0}:{1}/{2}:{3}/{4}", CatalogStream, CatalogPosition, DataStream, DataPosition, CommitPosition); break; default: return("Unsupported mode: " + Mode_.ToString()); } if (Phase == 0) { return(result); } else { return("(" + Phase + ") " + result); } }