OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Parsing / DVD.cs
1 using System;\r
2 using System.Collections.Generic;\r
3 using System.Windows.Forms;\r
4 using System.IO;\r
5 \r
6 namespace Handbrake.Parsing\r
7 {\r
8     \r
9     /// <summary>\r
10     /// An object representing a scanned DVD\r
11     /// </summary>\r
12     public class DVD\r
13     {\r
14 \r
15         private List<Title> m_titles;\r
16         /// <summary>\r
17         /// Collection of Titles associated with this DVD\r
18         /// </summary>\r
19         public List<Title> Titles\r
20         {\r
21             get\r
22             {\r
23                 return this.m_titles;\r
24             }\r
25         }\r
26 \r
27         /// <summary>\r
28         /// Default constructor for this object\r
29         /// </summary>\r
30         public DVD()\r
31         {\r
32             this.m_titles = new List<Title>();\r
33         }\r
34 \r
35         public static DVD Parse(StreamReader output)\r
36         {\r
37             DVD thisDVD = new DVD();\r
38             try\r
39             {\r
40                 while (!output.EndOfStream)\r
41                 {\r
42                     if ((char)output.Peek() == '+')\r
43                         thisDVD.m_titles.AddRange(Title.ParseList(output.ReadToEnd()));\r
44                     else\r
45                         output.ReadLine();\r
46                 }\r
47             }\r
48             catch (Exception exc)\r
49             {\r
50                 MessageBox.Show("DVD.CS - Parse" + exc.ToString());\r
51             }\r
52             return thisDVD;\r
53         }\r
54     }\r
55 }\r