/[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/09 17:42:34	90
+++ trunk/libxmltv/Core/XMLTVProgram.cs	2013/03/09 17:48:02	91
@@ -43,30 +43,30 @@
 
         private void InternalDictionaryAddKnownProperties()
         {
-            Properties = new PropertyDictionary();
-            Properties.AddProperty("Id", 0);
-            Properties.AddProperty(XMLTVConstants.Programs.ProgramStart, new DateTime());
-            Properties.AddProperty(XMLTVConstants.Programs.ProgramStop, new DateTime());
-            Properties.AddProperty(XMLTVConstants.Programs.ProgramChannelId, string.Empty);
-            Properties.AddProperty(XMLTVConstants.Programs.ProgramTitle, string.Empty);
-            Properties.AddProperty(XMLTVConstants.Programs.ProgramSubTitle, string.Empty);
-            Properties.AddProperty(XMLTVConstants.Programs.ProgramDescription, string.Empty);
+            MetaData = new PropertyDictionary();
+            MetaData.AddProperty("Id", 0);
+            MetaData.AddProperty(XMLTVConstants.Programs.ProgramStart, new DateTime());
+            MetaData.AddProperty(XMLTVConstants.Programs.ProgramStop, new DateTime());
+            MetaData.AddProperty(XMLTVConstants.Programs.ProgramChannelId, string.Empty);
+            MetaData.AddProperty(XMLTVConstants.Programs.ProgramTitle, string.Empty);
+            MetaData.AddProperty(XMLTVConstants.Programs.ProgramSubTitle, string.Empty);
+            MetaData.AddProperty(XMLTVConstants.Programs.ProgramDescription, string.Empty);
         }
 
         #region Property Dictionary Support
-        public PropertyDictionary Properties { get; private set; }
+        public PropertyDictionary MetaData { get; private set; }
         #endregion
 
         #endregion
         public override string ToString()
         {
             return string.Format("{0}: {1} - {2} ({3}) ['{4}' <==> '{5}']",
-                Properties["Id"].ToString(),
-                 Properties[(XMLTVConstants.Programs.ProgramTitle)].ToString(),
-                 Properties[(XMLTVConstants.Programs.ProgramSubTitle)].ToString(),
-                 Properties[(XMLTVConstants.Programs.ProgramChannelId)].ToString(),
-                ((DateTime) Properties[XMLTVConstants.Programs.ProgramStart]).ToString("yyyy/MM/dd hh:mm tt"),
-                ((DateTime) Properties[XMLTVConstants.Programs.ProgramStop]).ToString("yyyy/MM/dd hh:mm tt"));
+                MetaData["Id"].ToString(),
+                 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"));
         }
 
 
@@ -86,7 +86,7 @@
                     {
                         
                         var list = (List<IXMLTVProgram>)field.GetValue(this.GetInstance());
-                        Properties["Id"] = list.Count + 1;
+                        MetaData["Id"] = list.Count + 1;
                         list.Add(this);
                         xmltv_logger.Verbose.Debug.WriteLine("Updating instance with program information: {0}", this.ToString());
                         field.SetValue(this.GetInstance(), list);
@@ -107,47 +107,6 @@
 
         private void Create(XElement node)
         {
-            //if (node.HasAttributes)
-            //{
-            //    var start = node.Attribute(XMLTVConstants.Programs.ProgramStart);
-            //    this.Start = start == null ? new DateTime() : ParseDate(start.Value);
-            //    if (!this.Start.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_start: {0}", start); }
-
-            //    var stop = node.Attribute(XMLTVConstants.Programs.ProgramStop);
-            //    this.Stop = stop == null ? new DateTime() : ParseDate(stop.Value);
-            //    if (!this.Stop.Equals(new DateTime())) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_stop: {0}", stop); }
-
-            //    var channelid = node.Attribute(XMLTVConstants.Programs.ProgramChannelId);
-            //    if (!string.IsNullOrEmpty(this.channelid)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_channelid: {0}", channelid); }
-            //    IXMLTVChannel channel = new XMLTVChannel();
-            //    string _channelid = channelid == null ? string.Empty : channelid.Value;
-            //    this.Channel = this.GetInstance().Channels.Find(m => m.Id == _channelid);
-            //    if (this.Channel == null) { this.Channel = new XMLTVChannel(); }
-            //    if (!string.IsNullOrEmpty(_channelid)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_channel: {0}", this.Channel.ToString()); }            //}
-            //try
-            //{
-            //    var title = node.Descendants(XMLTVConstants.Programs.ProgramTitle).FirstOrDefault();
-            //    this.Title = title == null ? string.Empty : title.Value;
-            //}
-            //catch (Exception) { this.Title = string.Empty; }
-            //if (!string.IsNullOrEmpty(this.Title)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_title: {0}", this.Title == string.Empty ? "empty" : this.Title); }
-            //try
-            //{
-            //    var subtitle = node.Descendants(XMLTVConstants.Programs.ProgramSubTitle).FirstOrDefault();
-            //    this.SubTitle = subtitle == null ? string.Empty : subtitle.Value;
-            //}
-            //catch (Exception) { this.SubTitle = string.Empty; }
-            //if (!string.IsNullOrEmpty(this.SubTitle)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_subtitle: {0}", this.SubTitle == string.Empty ? "empty" : this.SubTitle); }
-            //try
-            //{
-            //    var description = node.Descendants(XMLTVConstants.Programs.ProgramDescription).FirstOrDefault();
-            //    this.Description = description == null ? string.Empty : description.Value; ;
-            //}
-            //catch (Exception) { this.Description = string.Empty; }
-            //if (!string.IsNullOrEmpty(this.Description)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_description: {0}", this.Description == string.Empty ? "empty" : this.Description); }
-
-            //ParseExtraData(node);
-
             var nodes = node.DescendantsAndSelf().ToList();
             foreach (var sub_node in nodes)
             {
@@ -242,7 +201,7 @@
                 if(node == null){throw new NullReferenceException("The node instance was null");}                
                 if (node.Value != null)
                 {
-                    instance.Properties.AddProperty(XMLTVConstants.Programs.ProgramTitle, node.Value);
+                    instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramTitle, node.Value);
                     xmltv_logger.Verbose.Debug.WriteLine("\tprogram_title: {0}", node.Value);
                 }                
             }
@@ -261,18 +220,18 @@
                     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); }
-                    instance.Properties.AddProperty(XMLTVConstants.Programs.ProgramStart, t_start);
+                    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); }
-                    instance.Properties.AddProperty(XMLTVConstants.Programs.ProgramStop, t_stop);
+                    instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramStop, t_stop);
 
                     var channelid = node.Attribute(XMLTVConstants.Programs.ProgramChannelId);
                     if (channelid != null)
                     {
                         if (!string.IsNullOrEmpty(channelid.Value)) { xmltv_logger.Verbose.Debug.WriteLine("\tprogram_channelid: {0}", channelid.Value); }
-                        instance.Properties.AddProperty(XMLTVConstants.Programs.ProgramChannelId, channelid.Value);
+                        instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramChannelId, channelid.Value);
                     }
                     
                 }
@@ -290,7 +249,7 @@
                 if (node == null) { throw new NullReferenceException("The node instance was null"); }
                 if (node.Value != null)
                 {
-                    instance.Properties.AddProperty(XMLTVConstants.Programs.ProgramSubTitle, node.Value);
+                    instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramSubTitle, node.Value);
                     xmltv_logger.Verbose.Debug.WriteLine("\tprogram_subtitle: {0}", node.Value);
                 }
             }
@@ -306,7 +265,7 @@
                 if (node == null) { throw new NullReferenceException("The node instance was null"); }
                 if (node.Value != null)
                 {
-                    instance.Properties.AddProperty(XMLTVConstants.Programs.ProgramDescription, node.Value);
+                    instance.MetaData.AddProperty(XMLTVConstants.Programs.ProgramDescription, node.Value);
                     xmltv_logger.Verbose.Debug.WriteLine("\tprogram_description: {0}", node.Value);
                 }
             }

 

  ViewVC Help
Powered by ViewVC 1.1.22