/[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

--- trunk/libxmltv/Core/XMLTVChannelCollection.cs	2013/03/09 01:46:42	71
+++ trunk/libxmltv/Core/XMLTVChannelCollection.cs	2013/03/09 09:29:40	72
@@ -9,30 +9,23 @@
 
 namespace libxmltv.Core
 {
-    internal class XMLTVChannelCollection : IDisposable
+    internal class XMLTVChannelCollection : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVChannelCollection, IDisposable
     {
         private Dictionary<string, IXMLTVChannel> entries = new Dictionary<string, IXMLTVChannel>();
-        internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
-        {
-            using (XMLTVChannelCollection g = new XMLTVChannelCollection(xmltv)) 
-            {
-                g.instance.Channels = g.Collection;
-                xmltv_logger.Info.WriteLine(g.ToString());
-            }
-        }
-        private XMLTVRuntimeInstance instance;
-        public XMLTVChannelCollection(XMLTVRuntimeInstance xmltv)
+        //internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
+        //{
+        //    using (XMLTVChannelCollection g = new XMLTVChannelCollection(xmltv)) { g.instance.Channels = g.Collection; }
+        //}
+        //private XMLTVRuntimeInstance instance;
+        public XMLTVChannelCollection(XMLTVRuntimeInstance instance) : base(instance)
         {
             xmltv_logger.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");
-            //IXMLTV_PARSER _xmltv;
-            //if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }
-            //XMLTV_PARSER = _xmltv;
-            instance = xmltv;
             Create();
+            xmltv_logger.Debug.WriteLine("Created Instance of XMLTVChannelCollection");
+            xmltv_logger.Info.WriteLine(this.ToString());
         }
 
-        #region IXMLTVSource
-        //private IXMLTV_PARSER XMLTV_PARSER { get; set; }
+        #region IXMLTVChannelCollection members
         public Dictionary<string, IXMLTVChannel> Collection
         {
             get { return entries; }
@@ -41,13 +34,13 @@
 
         private void Create()
         {
-            var doc = XDocument.Parse(instance.XmlDoc);
+            var doc = XDocument.Parse(this.GetInstance().XmlDoc);
             double channel_index = 0;
             double channel_count = doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT).Count();
             double progress = 0;
             foreach (var c in doc.Descendants(XMLTVConstants.CHANNEL_ELEMENT))
             {
-                if (instance.IsAborting)
+                if (this.GetInstance().IsAborting)
                 {
                     xmltv_logger.Verbose.Debug.WriteLine("Detected Instance abort event...");
                     break;

 

  ViewVC Help
Powered by ViewVC 1.1.22