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

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

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

trunk/libxmltv/Core/XMLTV_LOADER.cs revision 22 by william, Thu Mar 7 10:20:50 2013 UTC trunk/libxmltv/Core/XMLTVLoader.cs revision 36 by william, Fri Mar 8 02:13:59 2013 UTC
# Line 9  using System.Xml.Linq; Line 9  using System.Xml.Linq;
9    
10  namespace libxmltv.Core  namespace libxmltv.Core
11  {    {  
12      internal class XMLTV_LOADER : IXMLTV_LOADER      internal class XMLTVLoader// : IXMLTV_LOADER
13      {      {
14          private string xmlfile = string.Empty;          private string xmlfile = string.Empty;
15          public XMLTV_LOADER(object xmltv)          private XMLTVRuntimeInstance instance;
16            public XMLTVLoader(string xml_file, XMLTVRuntimeInstance xmltv)
17          {          {
18              string _xmltv;              XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVLoader");
19              if (!Internals.VerifyInstance<string>(xmltv, out _xmltv)) { return; }              //string _xmltv;
20              xmlfile = _xmltv;              //if (!Internals.VerifyInstance<string>(xmltv, out _xmltv)) { return; }
21                //xmlfile = _xmltv;
22                //LoadXml();
23                instance = xmltv;
24                instance.XmlFile = new FileInfo(xml_file);
25              LoadXml();              LoadXml();
26          }          }
27          #region IXMLTV_LOADER          //#region IXMLTV_LOADER
28          public FileInfo XmlFile { get { return new FileInfo(xmlfile); } }          //public FileInfo XmlFile { get { return new FileInfo(xmlfile); } }
29          public XDocument XmlDoc { get; private set; }          //public XDocument XmlDoc { get; private set; }
30          #endregion          //#endregion
31    
32          private void LoadXml()          private void LoadXml()
33          {          {
34              XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", XmlFile.Name);              XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", instance.XmlFile.Name);
35              //XMLTV_LOGGER.Log.Warn.WriteLine("XML File Loading has not been implemented yet!");              //XMLTV_LOGGER.Log.Warn.WriteLine("XML File Loading has not been implemented yet!");
36              try              try
37              {              {
38                  XmlDoc =  XDocument.Load(XmlFile.FullName);                  instance.XmlDoc = XDocument.Load(instance.XmlFile.FullName);
39              }              }
40              catch (Exception ex)              catch (Exception ex)
41              {              {
42                  XMLTV_LOGGER.Log.Error.WriteLine("Failed to load XMLTV File: {0}", XmlFile.Name);                  XMLTV_LOGGER.Log.Error.WriteLine("Failed to load XMLTV File: {0}", instance.XmlFile.Name);
43                  XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString());                  XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString());
44              }              }
45          }          }

Legend:
Removed from v.22  
changed lines
  Added in v.36

  ViewVC Help
Powered by ViewVC 1.1.22