2 using System.Collections.Generic;
\r
6 namespace Handbrake.Parsing
\r
8 public class Subtitle
\r
10 private int m_trackNumber;
\r
11 public int TrackNumber
\r
15 return this.m_trackNumber;
\r
19 private string m_language;
\r
20 public string Language
\r
24 return this.m_language;
\r
28 public override string ToString()
\r
30 return string.Format("{0} {1}", this.m_trackNumber, this.m_language);
\r
33 public static Subtitle Parse(StreamReader output)
\r
35 string curLine = output.ReadLine();
\r
36 if (!curLine.Contains("HandBrake has exited."))
\r
38 Subtitle thisSubtitle = new Subtitle();
\r
39 string[] splitter = curLine.Split(new string[] { " + ", ", " }, StringSplitOptions.RemoveEmptyEntries);
\r
40 thisSubtitle.m_trackNumber = int.Parse(splitter[0]);
\r
41 thisSubtitle.m_language = splitter[1];
\r
42 return thisSubtitle;
\r
50 public static Subtitle[] ParseList(StreamReader output)
\r
52 List<Subtitle> subtitles = new List<Subtitle>();
\r
53 while ((char)output.Peek() != '+') // oh glorious hack, serve me well
\r
55 Subtitle thisSubtitle = Subtitle.Parse(output);
\r
56 if (thisSubtitle != null)
\r
58 subtitles.Add(thisSubtitle);
\r
65 return subtitles.ToArray();
\r