documentation added
[gn-sub.git] / src / SubLib / Core / Domain / Headers.cs
blobddc39ad8577435f450df222eb315dfd4a80e40f6
1 /*
2 * This file is part of SubLib.
3 * Copyright (C) 2006-2010 Pedro Castro
5 * SubLib is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * SubLib is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 using System;
21 using System.IO;
22 using System.Text;
24 namespace SubLib.Core.Domain {
26 /// <summary>Represents the headers of the supported subtitle formats.</summary>
27 public class Headers : ICloneable {
29 private string title = String.Empty;
30 private string author = String.Empty;
31 private string movieAuthor = String.Empty;
32 private string artist = String.Empty;
33 private string album = String.Empty;
34 private string videoSource = String.Empty;
35 private string subtitlesSource = String.Empty;
36 private string program = String.Empty;
37 private string version = String.Empty;
38 private string comment = String.Empty;
39 private string fontColor = "&HFFFFFF";
40 private string fontStyle = "bd";
41 private string fontName = "Tahoma";
42 private string fileProperties = String.Empty;
43 private string mediaType = "VIDEO";
44 private string originalScript = "<unknown>";
45 private string originalTranslation = String.Empty;
46 private string originalEditing = String.Empty;
47 private string originalTiming = String.Empty;
48 private string originalScriptChecking = String.Empty;
49 private string scriptUpdatedBy = String.Empty;
50 private string collisions = String.Empty;
51 private string timer = String.Empty;
52 private string frameRate = String.Empty;
53 private string date = DateTime.Today.ToString("yyyy-MM-dd");
54 private int playResX = 0;
55 private int playResY = 0;
56 private int playDepth = 0;
57 private int fontSize = 24;
58 private int delay = 0;
59 private int cdTrack = 0;
62 /* Public properties */
64 /// <summary>The movie's title.</summary>
65 public string Title {
66 get { return title; }
67 set { title = value; }
70 /// <summary>The subtitles' author.</summary>
71 public string Author {
72 get { return author; }
73 set { author = value; }
76 /// <summary>The movie's author.</summary>
77 public string MovieAuthor {
78 get { return movieAuthor; }
79 set { movieAuthor = value; }
82 /// <summary>The subtitles' artist.</summary>
83 public string Artist {
84 get { return artist; }
85 set { artist = value; }
88 /// <summary>The subtitles' album.</summary>
89 public string Album {
90 get { return album; }
91 set { album = value; }
94 /// <summary>The video' source.</summary>
95 public string VideoSource {
96 get { return videoSource; }
97 set { videoSource = value; }
100 /// <summary>The subtitles' source.</summary>
101 public string SubtitlesSource {
102 get { return subtitlesSource; }
103 set { subtitlesSource = value; }
106 /// <summary>The name of the subtitles' program.</summary>
107 public string Program {
108 get { return program; }
109 set { program = value; }
112 /// <summary>The version of the subtitles.</summary>
113 public string Version {
114 get { return version; }
115 set { version = value; }
118 /// <summary>A comment or note on the subtitles.</summary>
119 public string Comment {
120 get { return comment; }
121 set { comment = value; }
124 /// <summary>The subtitles' font color.</summary>
125 public string FontColor {
126 get { return fontColor; }
127 set { fontColor = value; }
130 /// <summary>The subtitles' font style.</summary>
131 public string FontStyle {
132 get { return fontStyle; }
133 set { fontStyle = value; }
136 /// <summary>The subtitles' font name.</summary>
137 public string FontName {
138 get { return fontName; }
139 set { fontName = value; }
142 /// <summary>The File properties, in the format 'size,md5'.</summary>
143 public string FileProperties {
144 get { return fileProperties; }
145 set { fileProperties = value; }
148 /// <summary>The Media Type of the subtitles, which can be 'VIDEO' or 'AUDIO'.</summary>
149 /// <remarks>This property is only set if the value is 'VIDEO' or 'AUDIO'. It's case insensitive.</remarks>
150 public string MediaType {
151 get { return mediaType; }
152 set {
153 string type = value.ToUpper();
154 if (type.Equals("VIDEO") || type.Equals("AUDIO"))
155 mediaType = type;
159 /// <summary>The Original Script of the subtitles.</summary>
160 public string OriginalScript {
161 get { return originalScript; }
162 set { originalScript = value; }
165 /// <summary>The Original Translation of the subtitles.</summary>
166 public string OriginalTranslation {
167 get { return originalTranslation; }
168 set { originalTranslation = value; }
171 /// <summary>The Original Editing of the subtitles.</summary>
172 public string OriginalEditing {
173 get { return originalEditing; }
174 set { originalEditing = value; }
177 /// <summary>The Original Timing of the subtitles.</summary>
178 public string OriginalTiming {
179 get { return originalTiming; }
180 set { originalTiming = value; }
183 /// <summary>The Original Script Checking of the subtitles.</summary>
184 public string OriginalScriptChecking {
185 get { return originalScriptChecking; }
186 set { originalScriptChecking = value; }
189 /// <summary>The Script Updated By of the subtitles.</summary>
190 public string ScriptUpdatedBy {
191 get { return scriptUpdatedBy; }
192 set { scriptUpdatedBy = value; }
195 /// <summary>The Collisions of the subtitles.</summary>
196 public string Collisions {
197 get { return collisions; }
198 set { collisions = value; }
201 /// <summary>The Timer of the subtitles.</summary>
202 public string Timer {
203 get { return timer; }
204 set { timer = value; }
207 /// <summary>The movie's frame rate.</summary>
208 public string FrameRate {
209 get { return frameRate; }
210 set { frameRate = value; }
213 /// <summary>The subtitles' date.</summary>
214 public string Date {
215 get { return date; }
216 set { date = value; }
219 /// <summary>The PlayResX of the subtitles.</summary>
220 public int PlayResX {
221 get { return playResX; }
222 set { playResX = value; }
225 /// <summary>The PlayResX of the subtitles as text.</summary>
226 public string PlayResXAsText {
227 get { return playResX.ToString(); }
228 set {
229 try {
230 playResX = Convert.ToInt32(value);
232 catch (Exception) {
237 /// <summary>The PlayResY of the subtitles.</summary>
238 public int PlayResY {
239 get { return playResY; }
240 set { playResY = value; }
243 /// <summary>The PlayResY of the subtitles as text.</summary>
244 public string PlayResYAsText {
245 get { return playResY.ToString(); }
246 set {
247 try {
248 playResY = Convert.ToInt32(value);
250 catch (Exception) {
255 /// <summary>The PlayDepth of the subtitles.</summary>
256 public int PlayDepth {
257 get { return playDepth; }
258 set { playDepth = value; }
261 /// <summary>The PlayResY of the subtitles as text.</summary>
262 public string PlayDepthAsText {
263 get { return playDepth.ToString(); }
264 set {
265 try {
266 playDepth = Convert.ToInt32(value);
268 catch (Exception) {
273 /// <summary>The subtitles' font size.</summary>
274 public int FontSize {
275 get { return fontSize; }
276 set { fontSize = value; }
279 /// <summary>The subtitles' font size as text.</summary>
280 public string FontSizeAsText {
281 get { return fontSize.ToString(); }
282 set {
283 try {
284 fontSize = Convert.ToInt32(value);
286 catch (Exception) {
291 /// <summary>The delay of the subtitles.</summary>
292 public int Delay {
293 get { return delay; }
294 set { delay = value; }
297 /// <summary>The delay of the subtitles as text.</summary>
298 public string DelayAsText {
299 get { return delay.ToString(); }
300 set {
301 try {
302 delay = Convert.ToInt32(value);
304 catch (Exception) {
309 /// <summary>The CD track of the subtitles.</summary>
310 public int CDTrack {
311 get { return cdTrack; }
312 set { cdTrack = value; }
315 /// <summary>The CD track of the subtitles as text.</summary>
316 public string CDTrackAsText {
317 get { return cdTrack.ToString(); }
318 set {
319 try {
320 cdTrack = Convert.ToInt32(value);
322 catch (Exception) {
328 /* Public methods */
330 public object Clone () {
331 return this.MemberwiseClone();