/// <summary> /// Parse a CLI string to a Chapter object /// </summary> /// <param name="output"> /// The output. /// </param> /// <returns> /// A chapter Object /// </returns> public static Chapter Parse(StringReader output) { // TODO add support for reading chapter names to the regex. Match m = Regex.Match( output.ReadLine(), @"^ \+ ([0-9]*): cells ([0-9]*)->([0-9]*), ([0-9]*) blocks, duration ([0-9]{2}:[0-9]{2}:[0-9]{2})"); if (m.Success) { var thisChapter = new Chapter { ChapterNumber = int.Parse(m.Groups[1].Value.Trim()), ChapterName = string.Empty, Duration = TimeSpan.Parse(m.Groups[5].Value) }; return thisChapter; } return null; }