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

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

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

--- trunk/libxmltv/Core/XMLTVChannel.cs	2013/03/09 11:28:41	77
+++ trunk/libxmltv/Core/XMLTVChannel.cs	2013/03/09 11:36:24	78
@@ -5,6 +5,8 @@
 using libxmltv.Interfaces;
 using System.Xml.Linq;
 using System.Reflection;
+using System.IO;
+using System.Diagnostics;
 
 namespace libxmltv.Core
 {
@@ -21,10 +23,14 @@
         public XMLTVChannel(XMLTVRuntimeInstance instance, XElement node)
             : base(instance, XMLTVConstants.CHANNEL_ELEMENT)
         {
-            xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannel");
-            Create(node);
-            xmltv_logger.Verbose.Debug.WriteLine("Created Instance of XMLTVChannel");
-            UpdateInstance();            
+            try
+            {
+                xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannel");
+                Create(node);
+                xmltv_logger.Verbose.Debug.WriteLine("Created Instance of XMLTVChannel");
+                UpdateInstance();
+            }
+            catch (IOException ex) { Debug.WriteLine(ex.ToString()); }
         }
         #region IXMLTVChannel members
         public string Id { get; private set; }
@@ -69,17 +75,17 @@
         }
 
         private void Create(XElement node)
-        {
-            // get the channel id
-            Id = node.Attribute(XMLTVConstants.Channels.ChannelId).Value;
-            xmltv_logger.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);
-            var names = node.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();
-            Number = Convert.ToInt32(names[1].Value);
-            xmltv_logger.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);
-            CallSign = names[2].Value;
-            xmltv_logger.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);
-            Name = names[3].Value;
-            xmltv_logger.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);
+        {          
+                // get the channel id
+                Id = node.Attribute(XMLTVConstants.Channels.ChannelId).Value;
+                xmltv_logger.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);
+                var names = node.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();
+                Number = Convert.ToInt32(names[1].Value);
+                xmltv_logger.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);
+                CallSign = names[2].Value;
+                xmltv_logger.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);
+                Name = names[3].Value;
+                xmltv_logger.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);          
         }
     }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22