using System; using System.Collections.Generic; using System.Linq; using System.Text; using libxmltv.Interfaces; using System.IO; using Enterprise.Logging; using System.Xml.Linq; namespace libxmltv.Core { internal class XMLTV_LOADER : IXMLTV_LOADER { private string xmlfile = string.Empty; public XMLTV_LOADER(object xmltv) { string _xmltv; if (!Internals.VerifyInstance(xmltv, out _xmltv)) { return; } xmlfile = _xmltv; LoadXml(); } #region IXMLTV_LOADER public FileInfo XmlFile { get { return new FileInfo(xmlfile); } } public XDocument XmlDoc { get; private set; } #endregion private void LoadXml() { XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", XmlFile.Name); //XMLTV_LOGGER.Log.Warn.WriteLine("XML File Loading has not been implemented yet!"); try { XmlDoc = XDocument.Load(XmlFile.FullName); } catch (Exception ex) { XMLTV_LOGGER.Log.Error.WriteLine("Failed to load XMLTV File: {0}", XmlFile.Name); XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString()); } } } }