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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 51 - (hide annotations) (download)
Fri Mar 8 06:39:56 2013 UTC (7 years, 8 months ago) by william
Original Path: trunk/libxmltv/Core/XMLTVInstance.cs
File size: 3070 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 46 public XMLTVRuntimeInstance(string xmlfile) : this(xmlfile, null) { }
14     public XMLTVRuntimeInstance(string xmlfile, EventHandler<CancelEventArgs> t) { CreateInstance(xmlfile,t); }
15     private void CreateInstance(string xmlfile, EventHandler<CancelEventArgs> t)
16 william 45 {
17 william 46 CancelEvent = t;
18 william 49 using (XMLTVInstance instance = new XMLTVInstance(xmlfile, this))
19 william 45 {
20     }
21     }
22 william 46
23 william 49 //internal XMLTVInstance Instance { get; private set; }
24 william 36
25     #region IXMLTV_LOADER members
26     public System.IO.FileInfo XmlFile { get; set; }
27 william 49 public string XmlDoc { get; set; }
28 william 36 #endregion
29     #region IXMLTV_PARSER Members
30     public IXMLTVSource Source { get; set; }
31     public Dictionary<string, IXMLTVChannel> Channels { get; set; }
32     public Dictionary<int, IXMLTVProgram> Programs { get; set; }
33     #endregion
34 william 44
35 william 51 public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer
36     {
37     get { return new XMLTVSerializer<XMLTVRuntimeInstance>(this); }
38     }
39 william 45 //public void Dispose()
40     //{
41     // IsDisposing = true;
42     // //throw new NotImplementedException();
43     //}
44 william 46 //public bool IsDisposing { get; private set; }
45    
46    
47     private event EventHandler<CancelEventArgs> CancelEvent = null;
48    
49     public bool IsAborting
50     {
51     get
52     {
53     if (CancelEvent != null)
54     {
55     CancelEventArgs e = new CancelEventArgs();
56     CancelEvent.Invoke(this, e);
57     if (e.Cancel)
58     {
59     xmltv_logger.Log.Verbose.Debug.WriteLine("Detected Instance abort event...");
60     }
61     return e.Cancel;
62     }
63     return false;
64     }
65     }
66    
67    
68 william 36 }
69    
70 william 44 internal class XMLTVInstance : IDisposable
71 william 36 {
72     public XMLTVInstance(string xmlfile, XMLTVRuntimeInstance instance)
73     {
74     CreateLoader(xmlfile, instance);
75     CreateParser(instance);
76     }
77    
78     private void CreateLoader(string xml_file, XMLTVRuntimeInstance instance)
79     {
80 william 44 //XMLTVLoader loader = new XMLTVLoader(xml_file, instance);
81     XMLTVLoader.CreateInstance(xml_file, instance);
82 william 36 }
83     private void CreateParser(XMLTVRuntimeInstance instance)
84     {
85 william 44 //XMLTVParser parser = new XMLTVParser(instance);
86     XMLTVParser.CreateInstance(instance);
87 william 36 }
88 william 44
89     public void Dispose()
90     {
91     //throw new NotImplementedException();
92     }
93 william 36 }
94     }

  ViewVC Help
Powered by ViewVC 1.1.22