14 |
[Serializable] |
[Serializable] |
15 |
internal class XMLTVProgram : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVProgram |
internal class XMLTVProgram : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVProgram |
16 |
{ |
{ |
17 |
public XMLTVProgram() : base(null,XMLTVConstants.PROGRAM_ELEMENT) |
public XMLTVProgram() |
18 |
|
: base(null, XMLTVConstants.Programs.RootElement) |
19 |
{ |
{ |
20 |
InternalDictionaryAddKnownProperties(); |
InternalDictionaryAddKnownProperties(); |
21 |
|
|
22 |
} |
} |
23 |
public XMLTVProgram(XMLTVRuntimeInstance instance, XElement node) |
public XMLTVProgram(XMLTVRuntimeInstance instance, XElement node) |
24 |
: base(instance, XMLTVConstants.PROGRAM_ELEMENT) |
: base(instance, XMLTVConstants.Programs.RootElement) |
25 |
{ |
{ |
26 |
InternalDictionaryAddKnownProperties(); |
InternalDictionaryAddKnownProperties(); |
27 |
try { |
try { |
167 |
// if (!this.Stop.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop); } |
// if (!this.Stop.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop); } |
168 |
|
|
169 |
// var channelid = node.Attribute(XMLTVConstants.Programs.ProgramChannelId); |
// var channelid = node.Attribute(XMLTVConstants.Programs.ProgramChannelId); |
170 |
// if (!string.IsNullOrEmpty(this.Description)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_channelid: {0}", channelid); } |
// if (!string.IsNullOrEmpty(this.channelid)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_channelid: {0}", channelid); } |
171 |
// IXMLTVChannel channel = new XMLTVChannel(); |
// IXMLTVChannel channel = new XMLTVChannel(); |
172 |
// string _channelid = channelid == null ? string.Empty : channelid.Value; |
// string _channelid = channelid == null ? string.Empty : channelid.Value; |
173 |
// this.Channel = this.GetInstance().Channels.Find(m => m.Id == _channelid); |
// this.Channel = this.GetInstance().Channels.Find(m => m.Id == _channelid); |
281 |
|
|
282 |
|
|
283 |
#region sub-classes |
#region sub-classes |
284 |
|
#region program title |
285 |
private class title : XMLTVBase<XMLTVProgram> |
private class title : XMLTVBase<XMLTVProgram> |
286 |
{ |
{ |
287 |
public title() : base(null, XMLTVConstants.Programs.ProgramTitle) { } |
public title() : base(null, XMLTVConstants.Programs.ProgramTitle) { } |
288 |
public title(XMLTVProgram instance, XElement node) |
public title(XMLTVProgram instance, XElement node) |
289 |
: base(instance, XMLTVConstants.Programs.ProgramTitle) |
: base(instance, XMLTVConstants.Programs.ProgramTitle) |
290 |
{ |
{ |
291 |
if(node == null){throw new NullReferenceException("The node instance was null");} |
if(node == null){throw new NullReferenceException("The node instance was null");} |
292 |
if (node.Value != null) |
if (node.Value != null) |
293 |
{ |
{ |
294 |
instance.AddProperty(XMLTVConstants.Programs.ProgramTitle, node.Value); |
instance.AddProperty(XMLTVConstants.Programs.ProgramTitle, node.Value); |
295 |
|
xmltv_logger.Verbose.Debug.WriteLine("\tprogram_title: {0}", node.Value); |
296 |
|
} |
297 |
|
} |
298 |
|
} |
299 |
|
#endregion |
300 |
|
#region program stop/start/channel (programme) |
301 |
|
private class programme : XMLTVBase<XMLTVProgram> |
302 |
|
{ |
303 |
|
public programme() : base(null, XMLTVConstants.Programs.RootElement) { } |
304 |
|
public programme(XMLTVProgram instance, XElement node) |
305 |
|
: base(instance, XMLTVConstants.Programs.RootElement) |
306 |
|
{ |
307 |
|
if (node == null) { throw new NullReferenceException("The node instance was null"); } |
308 |
|
if (node.HasAttributes) |
309 |
|
{ |
310 |
|
var start = node.Attribute(XMLTVConstants.Programs.ProgramStart); |
311 |
|
var t_start = start == null ? new DateTime() : ParseDate(start.Value); |
312 |
|
if (!t_start.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_start: {0}", start); } |
313 |
|
instance.AddProperty(XMLTVConstants.Programs.ProgramStart, t_start); |
314 |
|
|
315 |
|
var stop = node.Attribute(XMLTVConstants.Programs.ProgramStop); |
316 |
|
var t_stop = stop == null ? new DateTime() : ParseDate(stop.Value); |
317 |
|
if (!t_stop.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop); } |
318 |
|
instance.AddProperty(XMLTVConstants.Programs.ProgramStop, t_stop); |
319 |
|
|
320 |
|
var channelid = node.Attribute(XMLTVConstants.Programs.ProgramChannelId); |
321 |
|
if (channelid != null) |
322 |
|
{ |
323 |
|
if (!string.IsNullOrEmpty(channelid.Value)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_channelid: {0}", channelid.Value); } |
324 |
|
instance.AddProperty(XMLTVConstants.Programs.ProgramChannelId, channelid.Value); |
325 |
|
} |
326 |
|
|
327 |
} |
} |
328 |
} |
} |
329 |
} |
} |
330 |
#endregion |
#endregion |
331 |
|
#endregion |
332 |
} |
} |
333 |
} |
} |