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.Collections.Generic;\r
8 using System.IO;\r
9 \r
10 namespace Handbrake.Parsing\r
11 {\r
12     /// <summary>\r
13     /// An object representing a scanned DVD\r
14     /// </summary>\r
15     public class DVD\r
16     {\r
17         private readonly List<Title> m_titles;\r
18 \r
19         /// <summary>\r
20         /// Default constructor for this object\r
21         /// </summary>\r
22         public DVD()\r
23         {\r
24             m_titles = new List<Title>();\r
25         }\r
26 \r
27         /// <summary>\r
28         /// Collection of Titles associated with this DVD\r
29         /// </summary>\r
30         public List<Title> Titles\r
31         {\r
32             get { return m_titles; }\r
33         }\r
34 \r
35         public static DVD Parse(StreamReader output)\r
36         {\r
37             var thisDVD = new DVD();\r
38 \r
39             while (!output.EndOfStream)\r
40             {\r
41                 if ((char) output.Peek() == '+')\r
42                     thisDVD.m_titles.AddRange(Title.ParseList(output.ReadToEnd()));\r
43                 else\r
44                     output.ReadLine();\r
45             }\r
46 \r
47             return thisDVD;\r
48         }\r
49     }\r
50 }