/[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 46 by william, Fri Mar 8 04:01:25 2013 UTC revision 55 by william, Fri Mar 8 10:19:32 2013 UTC
# Line 14  namespace libxmltv.Core Line 14  namespace libxmltv.Core
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)          internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
16          {          {
17              using (XMLTVChannelCollection g = new XMLTVChannelCollection(xmltv)) { g.instance.Channels = g.Collection; }              using (XMLTVChannelCollection g = new XMLTVChannelCollection(xmltv))
18                {
19                    g.instance.Channels = g.Collection;
20                    xmltv_logger.Info.WriteLine(g.ToString());
21                }
22          }          }
23          private XMLTVRuntimeInstance instance;          private XMLTVRuntimeInstance instance;
24          public XMLTVChannelCollection(XMLTVRuntimeInstance xmltv)          public XMLTVChannelCollection(XMLTVRuntimeInstance xmltv)
25          {          {
26              xmltv_logger.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");              xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");
27              //IXMLTV_PARSER _xmltv;              //IXMLTV_PARSER _xmltv;
28              //if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }              //if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }
29              //XMLTV_PARSER = _xmltv;              //XMLTV_PARSER = _xmltv;
# Line 37  namespace libxmltv.Core Line 41  namespace libxmltv.Core
41    
42          private void Create()          private void Create()
43          {          {
44              var doc = instance.XmlDoc;              var doc = XDocument.Parse(instance.XmlDoc);
45    
46              foreach (var c in doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT))              foreach (var c in doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT))
47              {              {
48                  if (instance.IsAborting)                  if (instance.IsAborting)
49                  {                  {
50                        xmltv_logger.Verbose.Debug.WriteLine("Detected Instance abort event...");
51                      break;                      break;
52                  }                  }
53                  Channel channel = new Channel(c);                  Channel channel = new Channel(c);
# Line 53  namespace libxmltv.Core Line 58  namespace libxmltv.Core
58          }          }
59          public override string ToString()          public override string ToString()
60          {          {
61              return string.Format("Channel Count: {0}", Collection == null ? 0 : Collection.Count);              return string.Format("Total Channels Parsed: {0}", Collection == null ? 0 : Collection.Count);
62          }          }
63    
64          public void Dispose()          public void Dispose()
# Line 76  namespace libxmltv.Core Line 81  namespace libxmltv.Core
81          {          {
82              // get the channel id              // get the channel id
83              Id = e.Attribute(XMLTVConstants.Channels.ChannelId).Value;              Id = e.Attribute(XMLTVConstants.Channels.ChannelId).Value;
84              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);
85              var names = e.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();              var names = e.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();
86              Number = Convert.ToInt32(names[1].Value);              Number = Convert.ToInt32(names[1].Value);
87              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);
88              CallSign = names[2].Value;              CallSign = names[2].Value;
89              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);
90              Name = names[3].Value;              Name = names[3].Value;
91              xmltv_logger.Log.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);
92          }          }
93          #region IXMLTVChannel members          #region IXMLTVChannel members
94          public string Id { get; private set; }          public string Id { get; private set; }

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

  ViewVC Help
Powered by ViewVC 1.1.22