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

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

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

revision 227 by william, Sun Mar 17 03:57:57 2013 UTC revision 254 by william, Wed Apr 17 21:55:30 2013 UTC
# Line 24  namespace libxmltv.Core Line 24  namespace libxmltv.Core
24              {              {
25              }              }
26              #endregion              #endregion
27    
28                
29          }          }
30          private class ChannelDefintion : IChannelDefintion          private class ChannelDefintion : IChannelDefintion
31          {          {
# Line 48  namespace libxmltv.Core Line 50  namespace libxmltv.Core
50                  }                  }
51                  return builder.ToString();                  return builder.ToString();
52              }              }
53    
54                private IXMLTVChannel _RawDataSource; public IXMLTVChannel RawDataSource { get { return _RawDataSource; } set { _RawDataSource = value; } }
55    
56    
57                public bool Equals(IChannelDefintion other)
58                {
59                    return this.ToString() == other.ToString();
60                }
61                public override bool Equals(object obj)
62                {
63                    if (obj == null) { throw new ArgumentNullException("obj", "Object to compare cannot be null"); }
64                    if (obj.GetType().IsAssignableFrom(typeof(IChannelDefintion)))
65                    {
66                        return this.Equals((IChannelDefintion)obj);
67                    }
68                    return base.Equals(obj);
69                }
70                public override int GetHashCode()
71                {
72                    return this.ToString().GetHashCode();
73                }
74    
75                            
76          }          }
77          //static private List<string> known_columns;          //static private List<string> known_columns;
# Line 84  namespace libxmltv.Core Line 108  namespace libxmltv.Core
108                  try                  try
109                  {                  {
110                      ChannelDefintion definition = new ChannelDefintion();                      ChannelDefintion definition = new ChannelDefintion();
111                        definition.RawDataSource = t;
112                      definition.ChannelId = t.Id;                      definition.ChannelId = t.Id;
113                      definition.ChannelName = t.MetaData[XMLTVConstants.Channels.ChannelDisplayName].FirstOrDefault().Value.ToString();                      definition.ChannelName = t.MetaData[XMLTVConstants.Channels.ChannelDisplayName].FirstOrDefault().Value.ToString();
114                      xmltv_logger.Verbose.Debug.WriteLine(definition.ToString());                      xmltv_logger.Verbose.Debug.WriteLine(definition.ToString());
# Line 116  namespace libxmltv.Core Line 141  namespace libxmltv.Core
141                      {                      {
142                          case "channelnumber": ordered = descending ? list.OrderByDescending(s => s.ChannelNumber) : list.OrderBy(s => s.ChannelNumber); break;                          case "channelnumber": ordered = descending ? list.OrderByDescending(s => s.ChannelNumber) : list.OrderBy(s => s.ChannelNumber); break;
143                          case "channelname": ordered = descending ? list.OrderByDescending(s => s.ChannelName) : list.OrderBy(s => s.ChannelName); break;                          case "channelname": ordered = descending ? list.OrderByDescending(s => s.ChannelName) : list.OrderBy(s => s.ChannelName); break;
144                          case "start": ordered = descending ? list.OrderByDescending(s => s.Start) : list.OrderBy(s => s.Start); break;                          case "start": ordered = descending ? list.OrderByDescending(s => DateTime.Parse(s.Start)) : list.OrderBy(s => DateTime.Parse(s.Start)); break;
145                          case "stop": ordered = descending ? list.OrderByDescending(s => s.Stop) : list.OrderBy(s => s.Stop); break;                          case "stop": ordered = descending ? list.OrderByDescending(s => DateTime.Parse(s.Stop)) : list.OrderBy(s => DateTime.Parse(s.Stop)); break;
146                          case "description": ordered = descending ? list.OrderByDescending(s => s.Description) : list.OrderBy(s => s.Description); break;                          case "description": ordered = descending ? list.OrderByDescending(s => s.Description) : list.OrderBy(s => s.Description); break;
147                          case "title": ordered = descending ? list.OrderByDescending(s => s.Title) : list.OrderBy(s => s.Title); break;                          case "title": ordered = descending ? list.OrderByDescending(s => s.Title) : list.OrderBy(s => s.Title); break;
148                          case "subtitle": ordered = descending ? list.OrderByDescending(s => s.SubTitle) : list.OrderBy(s => s.SubTitle); break;                          case "subtitle": ordered = descending ? list.OrderByDescending(s => s.SubTitle) : list.OrderBy(s => s.SubTitle); break;
# Line 131  namespace libxmltv.Core Line 156  namespace libxmltv.Core
156                          {                          {
157                              case "channelnumber": ordered = descending ? ordered.ThenByDescending(s => s.ChannelNumber) : ordered.ThenBy(s => s.ChannelNumber); break;                              case "channelnumber": ordered = descending ? ordered.ThenByDescending(s => s.ChannelNumber) : ordered.ThenBy(s => s.ChannelNumber); break;
158                              case "channelname": ordered = descending ? list.OrderByDescending(s => s.ChannelName) : list.OrderBy(s => s.ChannelName); break;                              case "channelname": ordered = descending ? list.OrderByDescending(s => s.ChannelName) : list.OrderBy(s => s.ChannelName); break;
159                              case "start": ordered = descending ? ordered.ThenByDescending(s => s.Start) : ordered.ThenBy(s => s.Start); break;                              case "start": ordered = descending ? ordered.ThenByDescending(s => DateTime.Parse(s.Start)) : ordered.ThenBy(s => DateTime.Parse(s.Start)); break;
160                              case "stop": ordered = descending ? ordered.ThenByDescending(s => s.Stop) : ordered.ThenBy(s => s.Stop); break;                              case "stop": ordered = descending ? ordered.ThenByDescending(s => DateTime.Parse(s.Stop)) : ordered.ThenBy(s => DateTime.Parse(s.Stop)); break;
161                              case "description": ordered = descending ? ordered.ThenByDescending(s => s.Description) : ordered.ThenBy(s => s.Description); break;                              case "description": ordered = descending ? ordered.ThenByDescending(s => s.Description) : ordered.ThenBy(s => s.Description); break;
162                              case "title": ordered = descending ? ordered.ThenByDescending(s => s.Title) : ordered.ThenBy(s => s.Title); break;                              case "title": ordered = descending ? ordered.ThenByDescending(s => s.Title) : ordered.ThenBy(s => s.Title); break;
163                              case "subtitle": ordered = descending ? ordered.ThenByDescending(s => s.SubTitle) : ordered.ThenBy(s => s.SubTitle); break;                              case "subtitle": ordered = descending ? ordered.ThenByDescending(s => s.SubTitle) : ordered.ThenBy(s => s.SubTitle); break;
# Line 183  namespace libxmltv.Core Line 208  namespace libxmltv.Core
208                  if (list != null) { source = list; }                  if (list != null) { source = list; }
209              }              }
210              #endregion              #endregion
211                
212          }          }
213          public class ProgramDefintion : IProgramDefinition, IEquatable<IProgramDefinition>          public class ProgramDefintion : IProgramDefinition, IEquatable<IProgramDefinition>
214          {          {
# Line 221  namespace libxmltv.Core Line 247  namespace libxmltv.Core
247                  return builder.ToString();                  return builder.ToString();
248              }              }
249    
250                private IXMLTVProgram _RawDataSource; public IXMLTVProgram RawDataSource { get { return _RawDataSource; } set { _RawDataSource = value; } }
251    
252              public bool Equals(IProgramDefinition other)              public bool Equals(IProgramDefinition other)
253              {              {
254                  return this.ToString() == other.ToString();                  return this.ToString() == other.ToString();
# Line 264  namespace libxmltv.Core Line 292  namespace libxmltv.Core
292                  try                  try
293                  {                  {
294                      ProgramDefintion definition = new ProgramDefintion();                      ProgramDefintion definition = new ProgramDefintion();
295                        definition.RawDataSource = t;
296                      string ChannelId = t.MetaData[XMLTVConstants.Programs.ProgramChannelId].ToString();                      string ChannelId = t.MetaData[XMLTVConstants.Programs.ProgramChannelId].ToString();
297                      //definition.ChannelId = ChannelId;                      //definition.ChannelId = ChannelId;
298    
# Line 313  namespace libxmltv.Core Line 342  namespace libxmltv.Core
342                  catch (Exception ex) { throw ex; }                  catch (Exception ex) { throw ex; }
343              }              }
344    
345              list = new ProgramDefinitionList(list.OrderBy(s => s.Start).ToList());              list = new ProgramDefinitionList(list.OrderBy(s => DateTime.Parse(s.Start)).ToList());
346    
347              bindable = list;              bindable = list;
348              return bindable;              return bindable;

Legend:
Removed from v.227  
changed lines
  Added in v.254

  ViewVC Help
Powered by ViewVC 1.1.22