/[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 44 by william, Fri Mar 8 03:36:44 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 : IDisposable
13      {      {
14          private string xmlfile = string.Empty;          private string xmlfile = string.Empty;
15          public XMLTV_LOADER(object xmltv)          internal static void CreateInstance(string xml_file, XMLTVRuntimeInstance xmltv)
16          {          {
17              string _xmltv;              using (XMLTVLoader g = new XMLTVLoader(xml_file, xmltv)) { }            
18              if (!Internals.VerifyInstance<string>(xmltv, out _xmltv)) { return; }          }
19              xmlfile = _xmltv;          private XMLTVRuntimeInstance instance;
20            protected XMLTVLoader(string xml_file, XMLTVRuntimeInstance xmltv)
21            {
22                XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVLoader");
23                //string _xmltv;
24                //if (!Internals.VerifyInstance<string>(xmltv, out _xmltv)) { return; }
25                //xmlfile = _xmltv;
26                //LoadXml();
27                instance = xmltv;
28                instance.XmlFile = new FileInfo(xml_file);
29              LoadXml();              LoadXml();
30          }          }
31          #region IXMLTV_LOADER          //#region IXMLTV_LOADER
32          public FileInfo XmlFile { get { return new FileInfo(xmlfile); } }          //public FileInfo XmlFile { get { return new FileInfo(xmlfile); } }
33          public XDocument XmlDoc { get; private set; }          //public XDocument XmlDoc { get; private set; }
34          #endregion          //#endregion
35    
36          private void LoadXml()          private void LoadXml()
37          {          {
38              XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", XmlFile.Name);              XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", instance.XmlFile.Name);
39              //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!");
40              try              try
41              {              {
42                  XmlDoc =  XDocument.Load(XmlFile.FullName);                  instance.XmlDoc = XDocument.Load(instance.XmlFile.FullName);
43              }              }
44              catch (Exception ex)              catch (Exception ex)
45              {              {
46                  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);
47                  XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString());                  XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString());
48              }              }
49          }          }
50    
51            public void Dispose()
52            {
53                //throw new NotImplementedException();
54            }
55      }      }
56  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.22