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 namespace Handbrake.Parsing\r
8 {\r
9     using System.Collections.Generic;\r
10     using System.IO;\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         /// Initializes a new instance of the <see cref="DVD"/> class. \r
21         /// Default constructor for this object\r
22         /// </summary>\r
23         public DVD()\r
24         {\r
25             m_titles = new List<Title>();\r
26         }\r
27 \r
28         /// <summary>\r
29         /// Collection of Titles associated with this DVD\r
30         /// </summary>\r
31         public List<Title> Titles\r
32         {\r
33             get { return m_titles; }\r
34         }\r
35 \r
36         public static DVD Parse(StreamReader output)\r
37         {\r
38             var thisDVD = new DVD();\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             return thisDVD;\r
49         }\r
50     }\r
51 }