8 |
|
namespace libxmltv.Core |
9 |
|
{ |
10 |
|
[Serializable] |
11 |
< |
internal class XMLTVSource : IXMLTVSource |
11 |
> |
internal class XMLTVSource : IXMLTVSource, IDisposable, ICloneable |
12 |
|
{ |
13 |
|
private Dictionary<string, string> entries = new Dictionary<string, string>(); |
14 |
+ |
internal static void CreateInstance(XMLTVRuntimeInstance xmltv) |
15 |
+ |
{ |
16 |
+ |
using (XMLTVSource g = new XMLTVSource(xmltv)) { g.instance.Source = (IXMLTVSource)g.Clone(); } |
17 |
+ |
} |
18 |
+ |
|
19 |
|
private XMLTVRuntimeInstance instance; |
20 |
< |
public XMLTVSource(XMLTVRuntimeInstance xmltv) |
20 |
> |
protected XMLTVSource(string sourcename, string generatorname, string generatorurl) |
21 |
> |
{ |
22 |
> |
} |
23 |
> |
protected XMLTVSource(XMLTVRuntimeInstance xmltv) |
24 |
|
{ |
25 |
|
XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVSource"); |
26 |
|
//IXMLTV_PARSER _xmltv; |
32 |
|
|
33 |
|
#region IXMLTVSource |
34 |
|
//private IXMLTV_PARSER XMLTV_PARSER { get; set; } |
35 |
< |
public string SourceName { get { return entries[XMLTVConstants.Source.SourceName]; } } |
36 |
< |
public string GeneratorName { get { return entries[XMLTVConstants.Source.GeneratorName]; } } |
37 |
< |
public string GeneratorUrl { get { return entries[XMLTVConstants.Source.GeneratorUrl]; } } |
35 |
> |
public string SourceName { get; private set; } |
36 |
> |
public string GeneratorName { get; private set; } |
37 |
> |
public string GeneratorUrl { get; private set; } |
38 |
|
#endregion |
39 |
|
|
40 |
|
private void Create() |
48 |
|
//XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("\t{0}: {1}", attribute.Name, attribute.Value); |
49 |
|
entries.Add(attribute.Name.ToString(), attribute.Value); |
50 |
|
} |
51 |
+ |
|
52 |
+ |
SourceName = entries[XMLTVConstants.Source.SourceName]; |
53 |
+ |
GeneratorName = entries[XMLTVConstants.Source.GeneratorName]; |
54 |
+ |
GeneratorUrl = entries[XMLTVConstants.Source.GeneratorUrl]; |
55 |
+ |
|
56 |
|
} |
57 |
|
public override string ToString() |
58 |
|
{ |
59 |
|
return string.Format("XmlTv Source: '{0}' (Generated by: '{1}') (support: '{2}')", SourceName, GeneratorName, GeneratorUrl); |
60 |
|
} |
61 |
+ |
|
62 |
+ |
public void Dispose() |
63 |
+ |
{ |
64 |
+ |
//throw new NotImplementedException(); |
65 |
+ |
} |
66 |
+ |
|
67 |
+ |
public object Clone() |
68 |
+ |
{ |
69 |
+ |
return new XMLTVSource(this.SourceName, this.GeneratorName, this.GeneratorUrl); |
70 |
+ |
} |
71 |
|
} |
72 |
|
} |