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

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

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

--- trunk/libxmltv/Core/XMLTVProgram.cs	2013/03/10 11:35:26	105
+++ trunk/libxmltv/Core/XMLTVProgram.cs	2013/03/10 12:58:40	107
@@ -180,7 +180,7 @@
             {
                 try
                 {
-                    raw_instance = Activator.CreateInstance(typeof(UnhandledExtraMetaData), flags, null, new object[] { this, node }, culture);
+                    raw_instance = Activator.CreateInstance(typeof(UnhandledExtraProgramMetaData), flags, null, new object[] { this, node }, culture);
                 }
                 catch (Exception ex) { throw ex; }
 
@@ -287,30 +287,25 @@
         #endregion
 
         #region UnhandledExtraMetaData
-        private class UnhandledExtraMetaData : XMLTVBase<XMLTVProgram>
+        private class UnhandledExtraProgramMetaData : XMLTVBase<XMLTVProgram>
         {
-            public UnhandledExtraMetaData() : base(null, null) { }
-            public UnhandledExtraMetaData(XMLTVProgram instance, XElement node)
+            public UnhandledExtraProgramMetaData() : base(null, null) { }
+            public UnhandledExtraProgramMetaData(XMLTVProgram instance, XElement node)
                 : base(instance, null)
             {
-                if (node == null) { throw new NullReferenceException("The node instance was null"); }
-                //if (node.Value != null)
-                //{
-                //    instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramDescription, node.Value);
-                //    xmltv_logger.Verbose.Debug.WriteLine("\tprogram_description: {0}", node.Value);
-                //}
-                xmltv_logger.Verbose.Debug.WriteLine("Parsng unhandled extra meta-data: {0}", node.Name.ToString());
-
+                if (node == null) { throw new NullReferenceException("The node instance was null"); }      
+                xmltv_logger.Verbose.Debug.WriteLine("Parsng unhandled extra program meta-data: {0}", node.Name.ToString());
                 if (this.GetInstance() != null)
                 {
-                    if (!instance.MetaData.ContainsProperty(XMLTVConstants.Programs.ProgramExtraMetaData))
-                    {
-                        instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramExtraMetaData, null);
-                    }
+                    List<ExtraMetaData> list = new List<ExtraMetaData>();
+                    if (!instance.MetaData.ContainsProperty(XMLTVConstants.Programs.ProgramExtraMetaData)) { instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramExtraMetaData, new List<ExtraMetaData>()); }
+                    else { list = (List<ExtraMetaData>)instance.MetaData[XMLTVConstants.Programs.ProgramExtraMetaData]; }
+                    ExtraMetaData data = new ExtraMetaData(node);
+                    list.Add(data);
+                    instance.MetaData[XMLTVConstants.Programs.ProgramExtraMetaData] = list;
                 }
-
             }
-        }
+        }       
         #endregion
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22