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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 52 - (show annotations) (download)
Fri Mar 8 07:01:37 2013 UTC (7 years, 4 months ago) by william
File size: 3625 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using libxmltv.Interfaces;
6 using System.ComponentModel;
7
8 namespace libxmltv.Core
9 {
10 [Serializable]
11 internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance, ISerializer<XMLTVRuntimeInstance>
12 {
13 public XMLTVRuntimeInstance(string xmlfile) { CreateInstance(xmlfile); }
14 //public XMLTVRuntimeInstance(string xmlfile) : this(xmlfile, null) { }
15 //public XMLTVRuntimeInstance(string xmlfile, EventHandler<CancelEventArgs> t) { CreateInstance(xmlfile,t); }
16 private void CreateInstance(string xmlfile)
17 {
18 //CancelEvent = t;
19 using (XMLTVInstance instance = new XMLTVInstance(xmlfile, this))
20 {
21 }
22 }
23
24 //internal XMLTVInstance Instance { get; private set; }
25
26 #region IXMLTV_LOADER members
27 public System.IO.FileInfo XmlFile { get; set; }
28 public string XmlDoc { get; set; }
29 #endregion
30 #region IXMLTV_PARSER Members
31 public IXMLTVSource Source { get; set; }
32 public Dictionary<string, IXMLTVChannel> Channels { get; set; }
33 public Dictionary<int, IXMLTVProgram> Programs { get; set; }
34 #endregion
35
36 public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer
37 {
38 get
39 {
40 ///* We have to set CancelEvent to null, before returning a new instance of the serializer otherwise all subscribers to the event will have to be marked as serializeable.
41 // Most subscribers will be of type: System.Windows.Forms which is not marked as serializable and will fail to serialize. */
42 //if (CancelEvent != null) { CancelEvent = null; }
43 return new XMLTVSerializer<XMLTVRuntimeInstance>(this);
44 }
45 }
46 //public void Dispose()
47 //{
48 // IsDisposing = true;
49 // //throw new NotImplementedException();
50 //}
51 //public bool IsDisposing { get; private set; }
52
53
54 //private event EventHandler<CancelEventArgs> CancelEvent = null;
55
56 public bool IsAborting
57 {
58 get
59 {
60 //if (CancelEvent != null)
61 //{
62 // CancelEventArgs e = new CancelEventArgs();
63 // CancelEvent.Invoke(this, e);
64 // if (e.Cancel)
65 // {
66 // xmltv_logger.Log.Verbose.Debug.WriteLine("Detected Instance abort event...");
67 // }
68 // return e.Cancel;
69 //}
70 //return false;
71 return false;
72 }
73 }
74
75
76 }
77
78 internal class XMLTVInstance : IDisposable
79 {
80 public XMLTVInstance(string xmlfile, XMLTVRuntimeInstance instance)
81 {
82 CreateLoader(xmlfile, instance);
83 CreateParser(instance);
84 }
85
86 private void CreateLoader(string xml_file, XMLTVRuntimeInstance instance)
87 {
88 //XMLTVLoader loader = new XMLTVLoader(xml_file, instance);
89 XMLTVLoader.CreateInstance(xml_file, instance);
90 }
91 private void CreateParser(XMLTVRuntimeInstance instance)
92 {
93 //XMLTVParser parser = new XMLTVParser(instance);
94 XMLTVParser.CreateInstance(instance);
95 }
96
97 public void Dispose()
98 {
99 //throw new NotImplementedException();
100 }
101 }
102 }

  ViewVC Help
Powered by ViewVC 1.1.22