/[xmltv_parser]/trunk/libxmltv/Core/XMLTVChannelCollection.cs
ViewVC logotype

Diff of /trunk/libxmltv/Core/XMLTVChannelCollection.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by william, Fri Mar 8 01:22:03 2013 UTC revision 36 by william, Fri Mar 8 02:13:59 2013 UTC
# Line 11  namespace libxmltv.Core Line 11  namespace libxmltv.Core
11      internal class XMLTVChannelCollection      internal class XMLTVChannelCollection
12      {      {
13          private Dictionary<string, IXMLTVChannel> entries = new Dictionary<string, IXMLTVChannel>();          private Dictionary<string, IXMLTVChannel> entries = new Dictionary<string, IXMLTVChannel>();
14          public XMLTVChannelCollection(object xmltv)          private XMLTVRuntimeInstance instance;
15            public XMLTVChannelCollection(XMLTVRuntimeInstance xmltv)
16          {          {
17              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");
18              IXMLTV_PARSER _xmltv;              //IXMLTV_PARSER _xmltv;
19              if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }              //if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }
20              XMLTV_PARSER = _xmltv;              //XMLTV_PARSER = _xmltv;
21                instance = xmltv;
22              Create();              Create();
23          }          }
24    
25          #region IXMLTVSource          #region IXMLTVSource
26          private IXMLTV_PARSER XMLTV_PARSER { get; set; }          //private IXMLTV_PARSER XMLTV_PARSER { get; set; }
27          public Dictionary<string, IXMLTVChannel> Collection          public Dictionary<string, IXMLTVChannel> Collection
28          {          {
29              get { return entries; }              get { return entries; }
# Line 30  namespace libxmltv.Core Line 32  namespace libxmltv.Core
32    
33          private void Create()          private void Create()
34          {          {
35              var doc = XMLTV_PARSER.XMLTV_LOADER.XmlDoc;              var doc = instance.XmlDoc;
36    
37              foreach (var c in doc.Descendants(XMLTV_CONSTANTS.CHANNEL_ELEMENT))              foreach (var c in doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT))
38              {              {
39                  Channel channel = new Channel(c);                  Channel channel = new Channel(c);
40                  entries.Add(channel.Id, channel);                  entries.Add(channel.Id, channel);
# Line 58  namespace libxmltv.Core Line 60  namespace libxmltv.Core
60              : this()              : this()
61          {          {
62              // get the channel id              // get the channel id
63              Id = e.Attribute(XMLTV_CONSTANTS.Channels.ChannelId).Value;              Id = e.Attribute(XMLTVConstants.Channels.ChannelId).Value;
64              var names = e.Descendants(XMLTV_CONSTANTS.Channels.ChannelDisplayName).ToList();              var names = e.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();
65              Number = Convert.ToInt32(names[1].Value);              Number = Convert.ToInt32(names[1].Value);
66              CallSign = names[2].Value;              CallSign = names[2].Value;
67              Name = names[3].Value;              Name = names[3].Value;

Legend:
Removed from v.35  
changed lines
  Added in v.36

  ViewVC Help
Powered by ViewVC 1.1.22