/[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/08 02:17:19	38
+++ trunk/libxmltv/Core/XMLTVSource.cs	2013/03/08 03:36:44	44
@@ -8,11 +8,19 @@
 namespace libxmltv.Core
 {
     [Serializable]
-    internal class XMLTVSource : IXMLTVSource
+    internal class XMLTVSource : 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(); }
+        }
+
         private XMLTVRuntimeInstance instance;
-        public XMLTVSource(XMLTVRuntimeInstance xmltv)
+        protected XMLTVSource(string sourcename, string generatorname, string generatorurl)
+        {
+        }
+        protected XMLTVSource(XMLTVRuntimeInstance xmltv)
         {
             XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVSource");
             //IXMLTV_PARSER _xmltv;
@@ -24,9 +32,9 @@
        
         #region IXMLTVSource
         //private IXMLTV_PARSER XMLTV_PARSER { get; set; }
-        public string SourceName { get { return entries[XMLTVConstants.Source.SourceName]; } }
-        public string GeneratorName { get { return entries[XMLTVConstants.Source.GeneratorName]; } }
-        public string GeneratorUrl { get { return entries[XMLTVConstants.Source.GeneratorUrl]; } }
+        public string SourceName { get; private set; }
+        public string GeneratorName { get; private set; }
+        public string GeneratorUrl { get; private set; }
         #endregion
 
         private void Create()
@@ -40,10 +48,25 @@
                 //XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\t{0}: {1}", attribute.Name, attribute.Value);
                 entries.Add(attribute.Name.ToString(), attribute.Value);
             }
+
+            SourceName = entries[XMLTVConstants.Source.SourceName];
+            GeneratorName = entries[XMLTVConstants.Source.GeneratorName];
+            GeneratorUrl = entries[XMLTVConstants.Source.GeneratorUrl];
+
         }
         public override string ToString()
         {
             return string.Format("XmlTv Source: '{0}' (Generated by: '{1}') (support: '{2}')", SourceName, GeneratorName, GeneratorUrl);
         }
+
+        public void Dispose()
+        {
+            //throw new NotImplementedException();
+        }
+
+        public object Clone()
+        {
+            return new XMLTVSource(this.SourceName, this.GeneratorName, this.GeneratorUrl);
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22