/[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 50 - (hide annotations) (download)
Fri Mar 8 06:15:44 2013 UTC (7 years, 7 months ago) by william
Original Path: trunk/libxmltv/Core/XMLTVInstance.cs
File size: 3097 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 45 internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance
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 50 //internal IXMLTVSerializer<IXMLTVRuntimeInstance> Serializer
36     //{
37     // get
38     // {
39     // return new XMLTVSerializer<IXMLTVRuntimeInstance>(this);
40     // }
41     //}
42 william 45 //public void Dispose()
43     //{
44     // IsDisposing = true;
45     // //throw new NotImplementedException();
46     //}
47 william 46 //public bool IsDisposing { get; private set; }
48    
49    
50     private event EventHandler<CancelEventArgs> CancelEvent = null;
51    
52     public bool IsAborting
53     {
54     get
55     {
56     if (CancelEvent != null)
57     {
58     CancelEventArgs e = new CancelEventArgs();
59     CancelEvent.Invoke(this, e);
60     if (e.Cancel)
61     {
62     xmltv_logger.Log.Verbose.Debug.WriteLine("Detected Instance abort event...");
63     }
64     return e.Cancel;
65     }
66     return false;
67     }
68     }
69    
70    
71 william 36 }
72    
73 william 44 internal class XMLTVInstance : IDisposable
74 william 36 {
75     public XMLTVInstance(string xmlfile, XMLTVRuntimeInstance instance)
76     {
77     CreateLoader(xmlfile, instance);
78     CreateParser(instance);
79     }
80    
81     private void CreateLoader(string xml_file, XMLTVRuntimeInstance instance)
82     {
83 william 44 //XMLTVLoader loader = new XMLTVLoader(xml_file, instance);
84     XMLTVLoader.CreateInstance(xml_file, instance);
85 william 36 }
86     private void CreateParser(XMLTVRuntimeInstance instance)
87     {
88 william 44 //XMLTVParser parser = new XMLTVParser(instance);
89     XMLTVParser.CreateInstance(instance);
90 william 36 }
91 william 44
92     public void Dispose()
93     {
94     //throw new NotImplementedException();
95     }
96 william 36 }
97     }

  ViewVC Help
Powered by ViewVC 1.1.22