/[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 43 by william, Fri Mar 8 03:09:49 2013 UTC revision 46 by william, Fri Mar 8 04:01:25 2013 UTC
# Line 9  using System.Windows.Forms; Line 9  using System.Windows.Forms;
9    
10  namespace libxmltv.Core  namespace libxmltv.Core
11  {  {
12      internal class XMLTVChannelCollection      internal class XMLTVChannelCollection : IDisposable
13      {      {
14          private Dictionary<string, IXMLTVChannel> entries = new Dictionary<string, IXMLTVChannel>();          private Dictionary<string, IXMLTVChannel> entries = new Dictionary<string, IXMLTVChannel>();
15            internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
16            {
17                using (XMLTVChannelCollection g = new XMLTVChannelCollection(xmltv)) { g.instance.Channels = g.Collection; }
18            }
19          private XMLTVRuntimeInstance instance;          private XMLTVRuntimeInstance instance;
20          public XMLTVChannelCollection(XMLTVRuntimeInstance xmltv)          public XMLTVChannelCollection(XMLTVRuntimeInstance xmltv)
21          {          {
22              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");              xmltv_logger.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");
23              //IXMLTV_PARSER _xmltv;              //IXMLTV_PARSER _xmltv;
24              //if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }              //if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }
25              //XMLTV_PARSER = _xmltv;              //XMLTV_PARSER = _xmltv;
# Line 37  namespace libxmltv.Core Line 41  namespace libxmltv.Core
41    
42              foreach (var c in doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT))              foreach (var c in doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT))
43              {              {
44                    if (instance.IsAborting)
45                    {
46                        break;
47                    }
48                  Channel channel = new Channel(c);                  Channel channel = new Channel(c);
49                  entries.Add(channel.Id, channel);                  entries.Add(channel.Id, channel);
50                  Application.DoEvents();                  Application.DoEvents();
51              }              }
52                //instance.Channels = Collection;
53          }          }
54          public override string ToString()          public override string ToString()
55          {          {
56              return string.Format("Channel Count: {0}", Collection == null ? 0 : Collection.Count);              return string.Format("Channel Count: {0}", Collection == null ? 0 : Collection.Count);
57          }          }
58    
59            public void Dispose()
60            {
61                //throw new NotImplementedException();
62            }
63      }      }
64      [Serializable]      [Serializable]
65      internal class Channel : IXMLTVChannel      internal class Channel : IXMLTVChannel
# Line 62  namespace libxmltv.Core Line 76  namespace libxmltv.Core
76          {          {
77              // get the channel id              // get the channel id
78              Id = e.Attribute(XMLTVConstants.Channels.ChannelId).Value;              Id = e.Attribute(XMLTVConstants.Channels.ChannelId).Value;
79              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);
80              var names = e.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();              var names = e.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();
81              Number = Convert.ToInt32(names[1].Value);              Number = Convert.ToInt32(names[1].Value);
82              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);
83              CallSign = names[2].Value;              CallSign = names[2].Value;
84              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);
85              Name = names[3].Value;              Name = names[3].Value;
86              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);
87          }          }
88          #region IXMLTVChannel members          #region IXMLTVChannel members
89          public string Id { get; private set; }          public string Id { get; private set; }

Legend:
Removed from v.43  
changed lines
  Added in v.46

  ViewVC Help
Powered by ViewVC 1.1.22