/[xmltv_parser]/trunk/libxmltv/Core/XMLTVSource.cs
ViewVC logotype

Diff of /trunk/libxmltv/Core/XMLTVSource.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 77 by william, Sat Mar 9 11:28:41 2013 UTC revision 121 by william, Sun Mar 10 18:30:13 2013 UTC
# Line 6  using libxmltv.Interfaces; Line 6  using libxmltv.Interfaces;
6  using System.Diagnostics;  using System.Diagnostics;
7  using System.Xml.Linq;  using System.Xml.Linq;
8  using System.Reflection;  using System.Reflection;
9    using System.IO;
10    
11  namespace libxmltv.Core  namespace libxmltv.Core
12  {  {
13      [Serializable]      [Serializable]
14      internal class XMLTVSource : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVSource, IDisposable//, ICloneable      internal class XMLTVSource : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVSource, IDisposable//, ICloneable
15      {      {
16            //static private List<string> known_columns;
17            //static XMLTVSource()
18            //{
19            //    known_columns.Add("Source Name");
20            //    known_columns.Add("Generator Name");
21            //    known_columns.Add("Generator Url");
22            //}
23                
24          private Dictionary<string, string> entries = new Dictionary<string, string>();          private Dictionary<string, string> entries = new Dictionary<string, string>();
25          //internal static void CreateInstance(XMLTVRuntimeInstance xmltv)          //internal static void CreateInstance(XMLTVRuntimeInstance xmltv)
# Line 26  namespace libxmltv.Core Line 34  namespace libxmltv.Core
34          //    this.GeneratorName = generatorname;          //    this.GeneratorName = generatorname;
35          //    this.GeneratorUrl = generatorurl;          //    this.GeneratorUrl = generatorurl;
36          //}          //}
37    
38    
39            public object CreateBindableDataSource()
40            {
41                object bindable = new object();
42    
43                List<PropertyValuePair> list = new List<PropertyValuePair>();
44                list.Add(new PropertyValuePair("Source Name", SourceName));
45                list.Add(new PropertyValuePair("Generator Name", GeneratorName));
46                list.Add(new PropertyValuePair("Generator Url", GeneratorUrl));
47                bindable = list;
48                return bindable;
49            }
50    
51          public XMLTVSource()          public XMLTVSource()
52              : base(null, XMLTVConstants.ROOT_ELEMENT)              : base(null, XMLTVConstants.Root.RootElement)
53          {          {
54              this.SourceName = string.Empty;              this.SourceName = string.Empty;
55              this.GeneratorName = string.Empty;              this.GeneratorName = string.Empty;
56              this.GeneratorUrl = string.Empty;              this.GeneratorUrl = string.Empty;
57          }          }
58          public XMLTVSource(XMLTVRuntimeInstance instance) : base(instance, XMLTVConstants.ROOT_ELEMENT)          public XMLTVSource(XMLTVRuntimeInstance instance)
59                : base(instance, XMLTVConstants.Root.RootElement)
60          {          {
61                try {
62              xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVSource");              xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVSource");
63              Create();              Create();
64              xmltv_logger.Verbose.Debug.WriteLine("Created Instance of XMLTVSource '{0}'", SourceName);              xmltv_logger.Verbose.Debug.WriteLine("Created Instance of XMLTVSource '{0}'", SourceName);
65              UpdateInstance();              UpdateInstance();
66                }
67                catch (IOException ex) { Debug.WriteLine(ex.ToString()); }
68          }          }
69    
70          private void UpdateInstance()          private void UpdateInstance()
# Line 80  namespace libxmltv.Core Line 106  namespace libxmltv.Core
106          private void Create()          private void Create()
107          {          {
108              var doc = XDocument.Parse(this.GetInstance().XmlDoc);              var doc = XDocument.Parse(this.GetInstance().XmlDoc);
109              Debug.Assert(doc.Root.Name == XMLTVConstants.ROOT_ELEMENT, string.Format("Expected Root Element: '{0}' but read: '{1}'", XMLTVConstants.ROOT_ELEMENT, doc.Root.Name));              Debug.Assert(doc.Root.Name == XMLTVConstants.Root.RootElement, string.Format("Expected Root Element: '{0}' but read: '{1}'", XMLTVConstants.Root.RootElement, doc.Root.Name));
110              //xmltv_logger.Verbose.Debug.WriteLine("\tRoot: {0}", doc.Root.Name);              //xmltv_logger.Verbose.Debug.WriteLine("\tRoot: {0}", doc.Root.Name);
111              var attributes = doc.Root.Attributes().ToList();              var attributes = doc.Root.Attributes().ToList();
112              foreach (var attribute in attributes)              foreach (var attribute in attributes)
# Line 107  namespace libxmltv.Core Line 133  namespace libxmltv.Core
133          //public object Clone()          //public object Clone()
134          //{          //{
135          //    return new XMLTVSource(this.SourceName, this.GeneratorName, this.GeneratorUrl);          //    return new XMLTVSource(this.SourceName, this.GeneratorName, this.GeneratorUrl);
136          //}          //}  
137      }      }
138  }  }

Legend:
Removed from v.77  
changed lines
  Added in v.121

  ViewVC Help
Powered by ViewVC 1.1.22