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

Contents of /trunk/libxmltv/Core/XMLTVProgramCollection.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 27 - (show annotations) (download)
Thu Mar 7 12:11:41 2013 UTC (7 years, 4 months ago) by william
File size: 2006 byte(s)
+ basic layout for Program entries

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using libxmltv.Interfaces;
6 using System.Xml.Linq;
7
8 namespace libxmltv.Core
9 {
10 internal class XMLTVProgramCollection
11 {
12 private Dictionary<int, IXMLTVProgram> entries = new Dictionary<int, IXMLTVProgram>();
13 public XMLTVProgramCollection(object xmltv)
14 {
15 XMLTV_LOGGER.Log.Verbose.Debug.WriteLine("Creating Instance of XMLTVChannelCollection");
16 IXMLTV_PARSER _xmltv;
17 if (!Internals.VerifyInstance<IXMLTV_PARSER>(xmltv, out _xmltv)) { return; }
18 XMLTV_PARSER = _xmltv;
19 Create();
20 }
21
22 #region IXMLTVSource
23 private IXMLTV_PARSER XMLTV_PARSER { get; set; }
24 public Dictionary<int, IXMLTVProgram> Collection
25 {
26 get { return entries; }
27 }
28 #endregion
29
30 private void Create()
31 {
32 var doc = XMLTV_PARSER.XMLTV_LOADER.XmlDoc;
33 int index = 0;
34 foreach (var c in doc.Descendants(XMLTV_CONSTANTS.PROGRAM_ELEMENT))
35 {
36 Program program = new Program(c, index);
37 entries.Add(program.ProgramId, program);
38 index++;
39 }
40 }
41 public override string ToString()
42 {
43 //return string.Format("XmlTv Source: '{0}' (Generated by: '{1}') (support: '{2}')", SourceName, GeneratorName, GeneratorUrl);
44 return string.Empty;
45 }
46 }
47
48 internal class Program : IXMLTVProgram
49 {
50 public Program()
51 {
52 ProgramId = 0;
53 }
54 public Program(XElement e, int index)
55 : this()
56 {
57 //ProgramId = e.Attribute(XMLTV_CONSTANTS.Programs.ChannelStart).Value;
58 ProgramId = index;
59 }
60 #region IXMLTVProgram members
61 public int ProgramId { get; private set; }
62 #endregion
63 }
64 }

  ViewVC Help
Powered by ViewVC 1.1.22