Merging the SubLib project with Gnome Subtitles
[gn-sub.git] / src / SubLib / Core / Domain / Headers.cs
blobcfd48276937a5bd0a6073c85b9ca9e74537fca6a
1 /*
2 * This file is part of SubLib.
3 * Copyright (C) 2006-2008 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 {
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;
61 /// <summary>The movie's title.</summary>
62 public string Title {
63 get { return title; }
64 set { title = value; }
67 /// <summary>The subtitles' author.</summary>
68 public string Author {
69 get { return author; }
70 set { author = value; }
73 /// <summary>The movie's author.</summary>
74 public string MovieAuthor {
75 get { return movieAuthor; }
76 set { movieAuthor = value; }
79 /// <summary>The subtitles' artist.</summary>
80 public string Artist {
81 get { return artist; }
82 set { artist = value; }
85 /// <summary>The subtitles' album.</summary>
86 public string Album {
87 get { return album; }
88 set { album = value; }
91 /// <summary>The video' source.</summary>
92 public string VideoSource {
93 get { return videoSource; }
94 set { videoSource = value; }
97 /// <summary>The subtitles' source.</summary>
98 public string SubtitlesSource {
99 get { return subtitlesSource; }
100 set { subtitlesSource = value; }
103 /// <summary>The name of the subtitles' program.</summary>
104 public string Program {
105 get { return program; }
106 set { program = value; }
109 /// <summary>The version of the subtitles.</summary>
110 public string Version {
111 get { return version; }
112 set { version = value; }
115 /// <summary>A comment or note on the subtitles.</summary>
116 public string Comment {
117 get { return comment; }
118 set { comment = value; }
121 /// <summary>The subtitles' font color.</summary>
122 public string FontColor {
123 get { return fontColor; }
124 set { fontColor = value; }
127 /// <summary>The subtitles' font style.</summary>
128 public string FontStyle {
129 get { return fontStyle; }
130 set { fontStyle = value; }
133 /// <summary>The subtitles' font name.</summary>
134 public string FontName {
135 get { return fontName; }
136 set { fontName = value; }
139 /// <summary>The File properties, in the format 'size,md5'.</summary>
140 public string FileProperties {
141 get { return fileProperties; }
142 set { fileProperties = value; }
145 /// <summary>The Media Type of the subtitles, which can be 'VIDEO' or 'AUDIO'.</summary>
146 /// <remarks>This property is only set if the value is 'VIDEO' or 'AUDIO'. It's case insensitive.</remarks>
147 public string MediaType {
148 get { return mediaType; }
149 set {
150 string type = value.ToUpper();
151 if (type.Equals("VIDEO") || type.Equals("AUDIO"))
152 mediaType = type;
156 /// <summary>The Original Script of the subtitles.</summary>
157 public string OriginalScript {
158 get { return originalScript; }
159 set { originalScript = value; }
162 /// <summary>The Original Translation of the subtitles.</summary>
163 public string OriginalTranslation {
164 get { return originalTranslation; }
165 set { originalTranslation = value; }
168 /// <summary>The Original Editing of the subtitles.</summary>
169 public string OriginalEditing {
170 get { return originalEditing; }
171 set { originalEditing = value; }
174 /// <summary>The Original Timing of the subtitles.</summary>
175 public string OriginalTiming {
176 get { return originalTiming; }
177 set { originalTiming = value; }
180 /// <summary>The Original Script Checking of the subtitles.</summary>
181 public string OriginalScriptChecking {
182 get { return originalScriptChecking; }
183 set { originalScriptChecking = value; }
186 /// <summary>The Script Updated By of the subtitles.</summary>
187 public string ScriptUpdatedBy {
188 get { return scriptUpdatedBy; }
189 set { scriptUpdatedBy = value; }
192 /// <summary>The Collisions of the subtitles.</summary>
193 public string Collisions {
194 get { return collisions; }
195 set { collisions = value; }
198 /// <summary>The Timer of the subtitles.</summary>
199 public string Timer {
200 get { return timer; }
201 set { timer = value; }
204 /// <summary>The movie's frame rate.</summary>
205 public string FrameRate {
206 get { return frameRate; }
207 set { frameRate = value; }
210 /// <summary>The subtitles' date.</summary>
211 public string Date {
212 get { return date; }
213 set { date = value; }
216 /// <summary>The PlayResX of the subtitles.</summary>
217 public int PlayResX {
218 get { return playResX; }
219 set { playResX = value; }
222 /// <summary>The PlayResX of the subtitles as text.</summary>
223 public string PlayResXAsText {
224 get { return playResX.ToString(); }
225 set {
226 try {
227 playResX = Convert.ToInt32(value);
229 catch (Exception) {
234 /// <summary>The PlayResY of the subtitles.</summary>
235 public int PlayResY {
236 get { return playResY; }
237 set { playResY = value; }
240 /// <summary>The PlayResY of the subtitles as text.</summary>
241 public string PlayResYAsText {
242 get { return playResY.ToString(); }
243 set {
244 try {
245 playResY = Convert.ToInt32(value);
247 catch (Exception) {
252 /// <summary>The PlayDepth of the subtitles.</summary>
253 public int PlayDepth {
254 get { return playDepth; }
255 set { playDepth = value; }
258 /// <summary>The PlayResY of the subtitles as text.</summary>
259 public string PlayDepthAsText {
260 get { return playDepth.ToString(); }
261 set {
262 try {
263 playDepth = Convert.ToInt32(value);
265 catch (Exception) {
270 /// <summary>The subtitles' font size.</summary>
271 public int FontSize {
272 get { return fontSize; }
273 set { fontSize = value; }
276 /// <summary>The subtitles' font size as text.</summary>
277 public string FontSizeAsText {
278 get { return fontSize.ToString(); }
279 set {
280 try {
281 fontSize = Convert.ToInt32(value);
283 catch (Exception) {
288 /// <summary>The delay of the subtitles.</summary>
289 public int Delay {
290 get { return delay; }
291 set { delay = value; }
294 /// <summary>The delay of the subtitles as text.</summary>
295 public string DelayAsText {
296 get { return delay.ToString(); }
297 set {
298 try {
299 delay = Convert.ToInt32(value);
301 catch (Exception) {
306 /// <summary>The CD track of the subtitles.</summary>
307 public int CDTrack {
308 get { return cdTrack; }
309 set { cdTrack = value; }
312 /// <summary>The CD track of the subtitles as text.</summary>
313 public string CDTrackAsText {
314 get { return cdTrack.ToString(); }
315 set {
316 try {
317 cdTrack = Convert.ToInt32(value);
319 catch (Exception) {