ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/xmltv_parser/trunk/libxmltv/Core/XMLTVLoader.cs
Revision: 36
Committed: Fri Mar 8 02:13:59 2013 UTC (10 years, 6 months ago) by william
File size: 1678 byte(s)
Log Message:
+ use a MarshalByRefObject

File Contents

# Content
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using libxmltv.Interfaces;
6 using System.IO;
7 using Enterprise.Logging;
8 using System.Xml.Linq;
9
10 namespace libxmltv.Core
11 {
12 internal class XMLTVLoader// : IXMLTV_LOADER
13 {
14 private string xmlfile = string.Empty;
15 private XMLTVRuntimeInstance instance;
16 public XMLTVLoader(string xml_file, XMLTVRuntimeInstance xmltv)
17 {
18 XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVLoader");
19 //string _xmltv;
20 //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();
26 }
27 //#region IXMLTV_LOADER
28 //public FileInfo XmlFile { get { return new FileInfo(xmlfile); } }
29 //public XDocument XmlDoc { get; private set; }
30 //#endregion
31
32 private void LoadXml()
33 {
34 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!");
36 try
37 {
38 instance.XmlDoc = XDocument.Load(instance.XmlFile.FullName);
39 }
40 catch (Exception ex)
41 {
42 XMLTV_LOGGER.Log.Error.WriteLine("Failed to load XMLTV File: {0}", instance.XmlFile.Name);
43 XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString());
44 }
45 }
46 }
47 }