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 XMLTV_LOADER : IXMLTV_LOADER |
13 |
{ |
14 |
private string xmlfile = string.Empty; |
15 |
public XMLTV_LOADER(object xmltv) |
16 |
{ |
17 |
string _xmltv; |
18 |
if (!Internals.VerifyInstance<string>(xmltv, out _xmltv)) { return; } |
19 |
xmlfile = _xmltv; |
20 |
LoadXml(); |
21 |
} |
22 |
#region IXMLTV_LOADER |
23 |
public FileInfo XmlFile { get { return new FileInfo(xmlfile); } } |
24 |
public XDocument XmlDoc { get; private set; } |
25 |
#endregion |
26 |
|
27 |
private void LoadXml() |
28 |
{ |
29 |
XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", XmlFile.Name); |
30 |
//XMLTV_LOGGER.Log.Warn.WriteLine("XML File Loading has not been implemented yet!"); |
31 |
try |
32 |
{ |
33 |
XmlDoc = XDocument.Load(XmlFile.FullName); |
34 |
} |
35 |
catch (Exception ex) |
36 |
{ |
37 |
XMLTV_LOGGER.Log.Error.WriteLine("Failed to load XMLTV File: {0}", XmlFile.Name); |
38 |
XMLTV_LOGGER.Log.Error.WriteLine(ex.GetBaseException().ToString()); |
39 |
} |
40 |
} |
41 |
} |
42 |
} |