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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 william 36 using System;
2     using System.Collections.Generic;
3     using System.Linq;
4     using System.Text;
5     using libxmltv.Interfaces;
6 william 46 using System.ComponentModel;
7 william 36
8     namespace libxmltv.Core
9     {
10 william 49 [Serializable]
11 william 51 internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance, ISerializer<XMLTVRuntimeInstance>
12 william 36 {
13 william 52 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 william 45 {
18 william 52 //CancelEvent = t;
19 william 49 using (XMLTVInstance instance = new XMLTVInstance(xmlfile, this))
20 william 45 {
21     }
22     }
23 william 46
24 william 49 //internal XMLTVInstance Instance { get; private set; }
25 william 36
26     #region IXMLTV_LOADER members
27     public System.IO.FileInfo XmlFile { get; set; }
28 william 49 public string XmlDoc { get; set; }
29 william 36 #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 william 44
36 william 51 public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer
37     {
38 william 52 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 william 51 }
46 william 45 //public void Dispose()
47     //{
48     // IsDisposing = true;
49     // //throw new NotImplementedException();
50     //}
51 william 46 //public bool IsDisposing { get; private set; }
52    
53    
54 william 52 //private event EventHandler<CancelEventArgs> CancelEvent = null;
55 william 46
56     public bool IsAborting
57     {
58     get
59     {
60 william 52 //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 william 46 return false;
72     }
73     }
74    
75    
76 william 36 }
77    
78 william 44 internal class XMLTVInstance : IDisposable
79 william 36 {
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 william 44 //XMLTVLoader loader = new XMLTVLoader(xml_file, instance);
89     XMLTVLoader.CreateInstance(xml_file, instance);
90 william 36 }
91     private void CreateParser(XMLTVRuntimeInstance instance)
92     {
93 william 44 //XMLTVParser parser = new XMLTVParser(instance);
94     XMLTVParser.CreateInstance(instance);
95 william 36 }
96 william 44
97     public void Dispose()
98     {
99     //throw new NotImplementedException();
100     }
101 william 36 }
102     }

  ViewVC Help
Powered by ViewVC 1.1.22