--- trunk/libxmltv/Core/XMLTVRuntimeInstance.cs 2013/03/09 11:23:09 76 +++ trunk/libxmltv/Core/XMLTVRuntimeInstance.cs 2013/03/09 11:40:15 79 @@ -48,7 +48,7 @@ private void init() { - this.Source = new List(); + this.Source = new XMLTVSource(); this.Channels = new List(); this.Programs = new List(); this.XmlFile_Name = string.Empty; @@ -69,8 +69,8 @@ private string _XmlDoc; public string XmlDoc { get { return _XmlDoc; } set { _XmlDoc = value; } } - private List _Source; - public List Source { get { return _Source; } set { _Source = value; } } + private IXMLTVSource _Source; + public IXMLTVSource Source { get { return _Source; } set { _Source = value; } } private List _Channels; public List Channels { get { return _Channels; } set { _Channels = value; } } private List _Programs; @@ -123,7 +123,7 @@ xmltv_logger.Debug.WriteLine("Loaded from instance..."); if (this.Source != null) { - xmltv_logger.Info.WriteLine("Source Loaded: '{0}' Created by '{1}' - original source file: '{2}'", this.Source.FirstOrDefault().SourceName, this.Source.FirstOrDefault().GeneratorName, this.XmlFile_FullName); + xmltv_logger.Info.WriteLine("Source Loaded: '{0}' Created by '{1}' - original source file: '{2}'", this.Source.SourceName, this.Source.GeneratorName, this.XmlFile_FullName); } else { @@ -132,7 +132,7 @@ } if (this.Channels != null) { - xmltv_logger.Info.WriteLine("Source Loaded: '{0}' Channels from source '{1}'", this.Channels.Count, this.Source.FirstOrDefault().SourceName); + xmltv_logger.Info.WriteLine("Source Loaded: '{0}' Channels from source '{1}'", this.Channels.Count, this.Source.SourceName); } else { @@ -141,7 +141,7 @@ } if (this.Programs != null) { - xmltv_logger.Info.WriteLine("Source Loaded: '{0}' Programs from source '{1}'", this.Programs.Count, this.Source.FirstOrDefault().SourceName); + xmltv_logger.Info.WriteLine("Source Loaded: '{0}' Programs from source '{1}'", this.Programs.Count, this.Source.SourceName); } else { @@ -232,6 +232,7 @@ CreateLoader(xmlfile); CreateParser(); } + catch (ThreadAbortException ex) { Debug.WriteLine(ex.ToString()); } catch (Exception ex) { xmltv_logger.Error.WriteLine(ex.ToString()); @@ -284,6 +285,10 @@ double progress = 0; foreach(var node in nodes) { + if (this.GetInstance().IsAborting) + { + break; + } if (!CreateHandlerForNode(node)) { xmltv_logger.Verbose.Debug.WriteLine("Unable to create handler for node: '{0}'", node.Name.ToString()); } node_index++; progress = 100.0 * (node_index / total_nodes);