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

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

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

revision 83 by william, Sat Mar 9 12:41:07 2013 UTC revision 99 by william, Sun Mar 10 10:18:06 2013 UTC
# Line 14  namespace libxmltv.Core Line 14  namespace libxmltv.Core
14      internal class XMLTVChannel : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVChannel      internal class XMLTVChannel : XMLTVBase<XMLTVRuntimeInstance>, IXMLTVChannel
15      {      {
16          public XMLTVChannel()          public XMLTVChannel()
17              : base(null, XMLTVConstants.CHANNEL_ELEMENT)              : base(null, XMLTVConstants.Channels.RootElement)
18          {          {
19                InternalDictionaryAddKnownProperties();
20              Id = string.Empty;              Id = string.Empty;
21              Number = 0;              //Number = 0;
22              CallSign = string.Empty;              //CallSign = string.Empty;
23              Name = string.Empty;              //Name = string.Empty;
24          }          }
25          public XMLTVChannel(XMLTVRuntimeInstance instance, XElement node)          public XMLTVChannel(XMLTVRuntimeInstance instance, XElement node)
26              : base(instance, XMLTVConstants.CHANNEL_ELEMENT)              : base(instance, XMLTVConstants.Channels.RootElement)
27          {          {
28                InternalDictionaryAddKnownProperties();
29              try              try
30              {              {
31                  xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannel");                  xmltv_logger.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannel");
# Line 33  namespace libxmltv.Core Line 35  namespace libxmltv.Core
35              }              }
36              catch (IOException ex) { Debug.WriteLine(ex.ToString()); }              catch (IOException ex) { Debug.WriteLine(ex.ToString()); }
37          }          }
38            private void InternalDictionaryAddKnownProperties()
39            {
40                MetaData = new PropertyList();
41                //MetaData.AddProperty("Id", string.Empty);
42            }
43          #region IXMLTVChannel members          #region IXMLTVChannel members
44          public string Id { get; private set; }          public string Id { get; private set; }
45          public int Number { get; private set; }          //public int Number { get; private set; }
46          public string CallSign { get; private set; }          //public string CallSign { get; private set; }
47          public string Name { get; private set; }          //public string Name { get; private set; }
48            private PropertyList _MetaData;
49            public PropertyList MetaData { get { return _MetaData; } private set { _MetaData = value; } }
50          #endregion          #endregion
51          public override string ToString()          public override string ToString()
52          {          {
53              return string.Format("{0}: {1} {2} ({3})", Id, Number, Name, CallSign);              return string.Format("{0}", Id);
54          }          }
55    
56          private void UpdateInstance()          private void UpdateInstance()
# Line 77  namespace libxmltv.Core Line 86  namespace libxmltv.Core
86    
87          private void Create(XElement node)          private void Create(XElement node)
88          {          {
89                //throw new NotImplementedException("Channel.Create(node) is not currently implemented.");
90              // get the channel id              // get the channel id
91              Id = node.Attribute(XMLTVConstants.Channels.ChannelId).Value;              Id = node.Attribute(XMLTVConstants.Channels.ChannelId).Value;
92              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_id: {0}", Id);
93              var names = node.Descendants(XMLTVConstants.Channels.ChannelDisplayName).ToList();              var names = node.Elements().ToList();
94              Number = Convert.ToInt32(names[1].Value);  
95              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_number: {0}", Number);              foreach (var name in names)
96              CallSign = names[2].Value;              {
97              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_callsign: {0}", CallSign);                  PropertyValuePair p = new PropertyValuePair(name.Name.ToString(), name.Value);
98              Name = names[3].Value;                  MetaData.AddProperty(p.Name,p.Value);
99              xmltv_logger.Verbose.Debug.WriteLine("\tchannel_name: {0}", Name);                  xmltv_logger.Verbose.Debug.WriteLine("\t{0}: {1}", p.Name, p.Value);
100                }
101    
102          }          }
103      }      }
104    

Legend:
Removed from v.83  
changed lines
  Added in v.99

  ViewVC Help
Powered by ViewVC 1.1.22