OSDN Git Service

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