1 |
using System; |
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using libxmltv.Interfaces; |
6 |
using System.Xml.Linq; |
7 |
|
8 |
namespace libxmltv.Core |
9 |
{ |
10 |
[Serializable] |
11 |
internal class XMLTVChannel : IXMLTVChannel |
12 |
{ |
13 |
public XMLTVChannel() |
14 |
{ |
15 |
Id = string.Empty; |
16 |
Number = 0; |
17 |
CallSign = string.Empty; |
18 |
Name = string.Empty; |
19 |
} |
20 |
public XMLTVChannel(XElement e) |
21 |
: this() |
22 |
{ |
23 |
// get the channel id |
24 |
Id = e.Attribute(XMLTVConstants.Channels.ChannelId).Value; |
25 |
xmltv_logger.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id); |
26 |
var names = e.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList(); |
27 |
Number = Convert.ToInt32(names[1].Value); |
28 |
xmltv_logger.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number); |
29 |
CallSign = names[2].Value; |
30 |
xmltv_logger.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign); |
31 |
Name = names[3].Value; |
32 |
xmltv_logger.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name); |
33 |
} |
34 |
#region IXMLTVChannel members |
35 |
public string Id { get; private set; } |
36 |
public int Number { get; private set; } |
37 |
public string CallSign { get; private set; } |
38 |
public string Name { get; private set; } |
39 |
#endregion |
40 |
public override string ToString() |
41 |
{ |
42 |
return string.Format("{0}: {1} {2} ({3})", Id, Number, Name, CallSign); |
43 |
} |
44 |
} |
45 |
|
46 |
} |