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

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

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

--- trunk/libxmltv/Core/XMLTVSource.cs	2013/03/09 01:46:42	71
+++ trunk/libxmltv/Core/XMLTVSource.cs	2013/03/09 09:29:40	72
@@ -9,33 +9,33 @@
 namespace libxmltv.Core
 {
     [Serializable]
-    internal class XMLTVSource : IXMLTVSource, IDisposable, ICloneable
+    internal class XMLTVSource : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVSource, IDisposable//, ICloneable
     {
+       
         private Dictionary<string, string> entries = new Dictionary<string, string>();
-        internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
-        {
-            using (XMLTVSource g = new XMLTVSource(xmltv))
-            {
-                g.instance.Source = (IXMLTVSource)g.Clone();
-                xmltv_logger.Info.WriteLine("Parsing Source: '{0}'", g.SourceName);
-            }
+        //internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
+        //{
+        //    using (XMLTVSource g = new XMLTVSource(xmltv)) { g.instance.Source = (IXMLTVSource)g.Clone(); }
+        //}
+
+        //private XMLTVRuntimeInstance instance;
+        //protected XMLTVSource(string sourcename, string generatorname, string generatorurl)
+        //{
+        //    this.SourceName = sourcename;
+        //    this.GeneratorName = generatorname;
+        //    this.GeneratorUrl = generatorurl;
+        //}
+        public XMLTVSource() : base(null) 
+        {
+            this.SourceName = string.Empty;
+            this.GeneratorName = string.Empty;
+            this.GeneratorUrl = string.Empty;
         }
-
-        private XMLTVRuntimeInstance instance;
-        protected XMLTVSource(string sourcename, string generatorname, string generatorurl)
-        {
-            this.SourceName = sourcename;
-            this.GeneratorName = generatorname;
-            this.GeneratorUrl = generatorurl;
-        }
-        protected XMLTVSource(XMLTVRuntimeInstance xmltv)
+        public XMLTVSource(XMLTVRuntimeInstance instance) : base(instance)
         {
             xmltv_logger.Debug.WriteLine("Creating Instance of XMLTVSource");
-            //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 XMLTVSource '{0}'", SourceName);
         }
        
         #region IXMLTVSource
@@ -47,7 +47,7 @@
 
         private void Create()
         {
-            var doc = XDocument.Parse(instance.XmlDoc);
+            var doc = XDocument.Parse(this.GetInstance().XmlDoc);
             Debug.Assert(doc.Root.Name == XMLTVConstants.ROOT_ELEMENT, string.Format("Expected Root Element: '{0}' but read: '{1}'", XMLTVConstants.ROOT_ELEMENT, doc.Root.Name));
             //xmltv_logger.Verbose.Debug.WriteLine("\tRoot: {0}", doc.Root.Name);
             var attributes = doc.Root.Attributes().ToList();
@@ -72,9 +72,9 @@
             //throw new NotImplementedException();
         }
 
-        public object Clone()
-        {
-            return new XMLTVSource(this.SourceName, this.GeneratorName, this.GeneratorUrl);
-        }
+        //public object Clone()
+        //{
+        //    return new XMLTVSource(this.SourceName, this.GeneratorName, this.GeneratorUrl);
+        //}
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22