/[xmltv_parser]/branches/linux/xmltv_parser/libxmltv/Core/XMLTVProgram.cs
ViewVC logotype

Diff of /branches/linux/xmltv_parser/libxmltv/Core/XMLTVProgram.cs

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

--- trunk/libxmltv/Core/XMLTVProgram.cs	2013/03/10 14:28:57	110
+++ trunk/libxmltv/Core/XMLTVProgram.cs	2013/03/14 13:08:20	141
@@ -54,8 +54,12 @@
         }
 
         #region Property Dictionary Support
-        private PropertyDictionary _MetaData;
-        public PropertyDictionary MetaData { get { return _MetaData; } private set { _MetaData = value; } }
+        private IPropertyDictionary _MetaData;
+        public IPropertyDictionary MetaData { get { return _MetaData; } private set { _MetaData = value; } }
+        public ExtraList GetExtraMetaData()
+        {
+            return (ExtraList)this.MetaData[XMLTVConstants.Programs.ProgramExtraMetaData];
+        }
         #endregion
 
         #endregion
@@ -66,8 +70,8 @@
                  MetaData[XMLTVConstants.Programs.ProgramTitle].ToString(),
                  MetaData[XMLTVConstants.Programs.ProgramSubTitle].ToString(),
                  MetaData[XMLTVConstants.Programs.ProgramChannelId].ToString(),
-                ((DateTime)MetaData[XMLTVConstants.Programs.ProgramStart]).ToString("yyyy/MM/dd hh:mm tt"),
-                ((DateTime)MetaData[XMLTVConstants.Programs.ProgramStop]).ToString("yyyy/MM/dd hh:mm tt"));
+                ((DateTime)MetaData[XMLTVConstants.Programs.ProgramStart]).ToDateTimeString(),
+                ((DateTime)MetaData[XMLTVConstants.Programs.ProgramStop]).ToDateTimeString());
         }
 
 
@@ -80,13 +84,13 @@
             var fields = instance_type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
             foreach (var field in fields)
             {
-                if (field.FieldType == typeof(List<IXMLTVProgram>))
+                if (field.FieldType == typeof(ProgramList))
                 {
                     found_field = true;
                     try
                     {
-                        
-                        var list = (List<IXMLTVProgram>)field.GetValue(this.GetInstance());
+
+                        var list = (ProgramList)field.GetValue(this.GetInstance());
                         MetaData["Id"] = list.Count + 1;
                         list.Add(this);
                         xmltv_logger.Verbose.Debug.WriteLine("Updating instance with program information: {0}", this.ToString());
@@ -161,6 +165,7 @@
                             var ctors = type.GetConstructors(flags);
                             bool has_default_ctor = false;
                             foreach (var ctor in ctors) { if (ctor.GetParameters().Count() == 0) { has_default_ctor = true; } }
+                            ctors = null;
                             if (!has_default_ctor) { continue; }
                             raw_instance = Activator.CreateInstance(type, flags, null, new object[0], culture);
                             if (raw_instance != null)
@@ -169,13 +174,25 @@
                                 if (handler_value != null && handler_value.ToString() == node.Name.ToString())
                                 {
                                     handler_type = type;
+                                    handler_value = null;
+                                    raw_instance = null;
+                                    handler_prop = null;
+                                    iface = null;
                                     break;
                                 }
+                                handler_value = null;
                             }
+                            raw_instance = null;
                         }
+                        handler_prop = null;
                     }
+                    iface = null;
                 }
             }
+            t = null;
+            asm = null;
+            types = null;
+            classes = null;
             if (handler_type == null)
             {
                 try
@@ -201,6 +218,10 @@
                 }
                 catch (Exception ex) { throw ex; }
             }
+            raw_instance = null;
+            flags = 0;
+            culture = null;
+            node = null;
         }
 
 
@@ -218,12 +239,20 @@
                 {                    
                     var start = node.Attribute(XMLTVConstants.Programs.ProgramStart);
                     var t_start = start == null ? new DateTime() : ParseDate(start.Value);
-                    if (!t_start.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_start: {0}", start); }
+                    if (!t_start.Equals(new DateTime())) 
+                    { 
+                        xmltv_logger.Verbose.Debug.WriteLine("\tprogram_start: {0}", start);
+                        xmltv_logger.Verbose.Debug.WriteLine("\tprogram_start dt: {0}", t_start.ToString()); 
+                    }
                     instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramStart, t_start);
 
                     var stop = node.Attribute(XMLTVConstants.Programs.ProgramStop);
                     var t_stop = stop == null ? new DateTime() : ParseDate(stop.Value);
-                    if (!t_stop.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop); }
+                    if (!t_stop.Equals(new DateTime())) 
+                    { 
+                        xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop);
+                        xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop dt: {0}", t_stop.ToString()); 
+                    }
                     instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramStop, t_stop);
 
                     var channelid = node.Attribute(XMLTVConstants.Programs.ProgramChannelId);
@@ -234,6 +263,7 @@
                     }
                     
                 }
+                node = null;
             }
         }
         #endregion
@@ -250,6 +280,7 @@
                     instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramTitle, node.Value);
                     xmltv_logger.Verbose.Debug.WriteLine("\tprogram_title: {0}", node.Value);
                 }
+                node = null;
             }
         }
         #endregion
@@ -266,6 +297,7 @@
                     instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramSubTitle, node.Value);
                     xmltv_logger.Verbose.Debug.WriteLine("\tprogram_subtitle: {0}", node.Value);
                 }
+                node = null;
             }
         }
         #endregion
@@ -282,6 +314,7 @@
                     instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramDescription, node.Value);
                     xmltv_logger.Verbose.Debug.WriteLine("\tprogram_description: {0}", node.Value);
                 }
+                node = null;
             }
         }
         #endregion
@@ -303,7 +336,9 @@
                     ExtraMetaData data = new ExtraMetaData(node);
                     list.Add(data);
                     instance.MetaData[XMLTVConstants.Programs.ProgramExtraMetaData] = list;
+                    data = null;
                 }
+                node = null;
             }
         }       
         #endregion

 

  ViewVC Help
Powered by ViewVC 1.1.22