1 |
william |
11 |
using System; |
2 |
|
|
using System.Collections.Generic; |
3 |
|
|
using System.Linq; |
4 |
|
|
using System.Text; |
5 |
|
|
using libxmltv.Interfaces; |
6 |
|
|
using System.IO; |
7 |
william |
14 |
using Enterprise.Logging; |
8 |
william |
19 |
using System.Xml.Linq; |
9 |
william |
11 |
|
10 |
|
|
namespace libxmltv.Core |
11 |
william |
22 |
{ |
12 |
william |
11 |
internal class XMLTV_LOADER : IXMLTV_LOADER |
13 |
|
|
{ |
14 |
|
|
private string xmlfile = string.Empty; |
15 |
william |
22 |
public XMLTV_LOADER(object xmltv) |
16 |
william |
11 |
{ |
17 |
william |
22 |
string _xmltv; |
18 |
|
|
if (!Internals.VerifyInstance<string>(xmltv, out _xmltv)) { return; } |
19 |
|
|
xmlfile = _xmltv; |
20 |
william |
16 |
LoadXml(); |
21 |
william |
11 |
} |
22 |
|
|
#region IXMLTV_LOADER |
23 |
|
|
public FileInfo XmlFile { get { return new FileInfo(xmlfile); } } |
24 |
william |
22 |
public XDocument XmlDoc { get; private set; } |
25 |
william |
11 |
#endregion |
26 |
william |
16 |
|
27 |
|
|
private void LoadXml() |
28 |
|
|
{ |
29 |
|
|
XMLTV_LOGGER.Log.Info.WriteLine("Loading XMLTV File: {0}", XmlFile.Name); |
30 |
william |
19 |
//XMLTV_LOGGER.Log.Warn.WriteLine("XML File Loading has not been implemented yet!"); |
31 |
william |
21 |
try |
32 |
|
|
{ |
33 |
william |
22 |
XmlDoc = XDocument.Load(XmlFile.FullName); |
34 |
william |
21 |
} |
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 |
william |
16 |
} |
41 |
william |
11 |
} |
42 |
|
|
} |