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

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

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

--- trunk/libxmltv/Core/XMLTV_PARSER.cs	2013/03/07 12:11:41	27
+++ trunk/libxmltv/Core/XMLTVParser.cs	2013/03/08 02:13:59	36
@@ -9,22 +9,25 @@
 
 namespace libxmltv.Core
 {
-    internal class XMLTV_PARSER : IXMLTV_PARSER
+    internal class XMLTVParser //: IXMLTV_PARSER
     {
-        
-        public XMLTV_PARSER(object xmltv)
+        private XMLTVRuntimeInstance instance;
+        public XMLTVParser(XMLTVRuntimeInstance xmltv)
         {
-            IXMLTV_LOADER _xmltv;
-            if (!Internals.VerifyInstance<IXMLTV_LOADER>(xmltv, out _xmltv)) { return; }
-            XMLTV_LOADER = _xmltv;
+            XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVParser");
+            //IXMLTV_LOADER _xmltv;
+            //if (!Internals.VerifyInstance<IXMLTV_LOADER>(xmltv, out _xmltv)) { return; }
+            //XMLTV_LOADER = _xmltv;
+            //Create();
+            instance = xmltv;
             Create();
         }
         #region IXMLTV_PARSER members
-        public IXMLTV_LOADER XMLTV_LOADER { get; private set; }
-        public void TestParse() { _imp_TestParse(); }
-        public IXMLTVSource Source { get; private set; }
-        public Dictionary<string, IXMLTVChannel> Channels { get; private set; }
-        public Dictionary<int, IXMLTVProgram> Programs { get; private set; }
+        //public IXMLTV_LOADER XMLTV_LOADER { get; private set; }
+        ////public void TestParse() { _imp_TestParse(); }
+        //public IXMLTVSource Source { get; private set; }
+        //public Dictionary<string, IXMLTVChannel> Channels { get; private set; }
+        //public Dictionary<int, IXMLTVProgram> Programs { get; private set; }
         #endregion
 
         #region Parser Testing Methods
@@ -32,7 +35,7 @@
         private void _imp_TestParse()
         {
             XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Running XML_PARSER Test");
-            var doc = XMLTV_LOADER.XmlDoc;
+            var doc = instance.XmlDoc;
             ParseRootElements(doc);
             ParseChannels(doc);
             ParsePrograms(doc);
@@ -41,7 +44,7 @@
         private void ParseRootElements(XDocument doc)
         {
             XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Parseing Root Data");            
-            Debug.Assert(doc.Root.Name == XMLTV_CONSTANTS.ROOT_ELEMENT, string.Format("Expected Root Element: '{0}' but read: '{1}'", XMLTV_CONSTANTS.ROOT_ELEMENT, doc.Root.Name));
+            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.Log.Verbose.Debug.WriteLine("\tRoot: {0}", doc.Root.Name);
             var attributes = doc.Root.Attributes().ToList();
             foreach (var attribute in attributes)
@@ -53,7 +56,7 @@
         private void ParseChannels(XDocument doc)
         {
             XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Parsing Channel Data");
-            var elements = doc.Root.Descendants(XMLTV_CONSTANTS.CHANNEL_ELEMENT).ToList();
+            var elements = doc.Root.Descendants(XMLTVConstants.CHANNEL_ELEMENT).ToList();
             foreach (var element in elements)
             {
                 if (element.HasAttributes)
@@ -80,7 +83,7 @@
         private void ParsePrograms(XDocument doc)
         {
             XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Parsing Program Data");
-            var elements = doc.Root.Descendants(XMLTV_CONSTANTS.PROGRAM_ELEMENT).ToList();
+            var elements = doc.Root.Descendants(XMLTVConstants.PROGRAM_ELEMENT).ToList();
             foreach (var element in elements)
             {
                 if (element.HasAttributes)
@@ -115,18 +118,18 @@
         }
         private void CreateXMLTVSource()
         {
-            XMLTVSource source = new XMLTVSource(this);
-            Source = source;
+            XMLTVSource source = new XMLTVSource(instance);
+            instance.Source = source;
         }
         private void CreateXMLTVChannels()
         {
-            XMLTVChannelCollection channels = new XMLTVChannelCollection(this);
-            Channels = channels.Collection;            
+            XMLTVChannelCollection channels = new XMLTVChannelCollection(instance);
+            instance.Channels = channels.Collection;            
         }
         private void CreateXMLTVPrograms()
         {
-            XMLTVProgramCollection programs = new XMLTVProgramCollection(this);
-            Programs = programs.Collection;
+            XMLTVProgramCollection programs = new XMLTVProgramCollection(instance);
+            instance.Programs = programs.Collection;
         }
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22