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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 36 by william, Fri Mar 8 02:13:59 2013 UTC revision 52 by william, Fri Mar 8 07:01:37 2013 UTC
# Line 3  using System.Collections.Generic; Line 3  using System.Collections.Generic;
3  using System.Linq;  using System.Linq;
4  using System.Text;  using System.Text;
5  using libxmltv.Interfaces;  using libxmltv.Interfaces;
6    using System.ComponentModel;
7    
8  namespace libxmltv.Core  namespace libxmltv.Core
9  {  {
10      internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance      [Serializable]
11        internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance, ISerializer<XMLTVRuntimeInstance>
12      {      {
13          public XMLTVRuntimeInstance(string xmlfile) { CreateInstance(xmlfile); }          public XMLTVRuntimeInstance(string xmlfile) { CreateInstance(xmlfile); }
14          private void CreateInstance(string xmlfile) { Instance = new XMLTVInstance(xmlfile, this); }          //public XMLTVRuntimeInstance(string xmlfile) : this(xmlfile, null) { }
15          internal XMLTVInstance Instance { get; private set; }          //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          #region IXMLTV_LOADER members
27          public System.IO.FileInfo XmlFile { get; set; }          public System.IO.FileInfo XmlFile { get; set; }
28          public System.Xml.Linq.XDocument XmlDoc { get; set; }          public string XmlDoc { get; set; }
29          #endregion          #endregion
30          #region IXMLTV_PARSER Members          #region IXMLTV_PARSER Members
31          public IXMLTVSource Source { get; set; }          public IXMLTVSource Source { get; set; }
32          public Dictionary<string, IXMLTVChannel> Channels { get; set; }          public Dictionary<string, IXMLTVChannel> Channels { get; set; }
33          public Dictionary<int, IXMLTVProgram> Programs { get; set; }          public Dictionary<int, IXMLTVProgram> Programs { get; set; }
34          #endregion            #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      internal class XMLTVInstance : IDisposable
79      {      {
80          public XMLTVInstance(string xmlfile, XMLTVRuntimeInstance instance)          public XMLTVInstance(string xmlfile, XMLTVRuntimeInstance instance)
81          {          {
# Line 33  namespace libxmltv.Core Line 85  namespace libxmltv.Core
85    
86          private void CreateLoader(string xml_file, XMLTVRuntimeInstance instance)          private void CreateLoader(string xml_file, XMLTVRuntimeInstance instance)
87          {          {
88              XMLTVLoader loader = new XMLTVLoader(xml_file, instance);              //XMLTVLoader loader = new XMLTVLoader(xml_file, instance);
89                XMLTVLoader.CreateInstance(xml_file, instance);
90          }          }
91          private void CreateParser(XMLTVRuntimeInstance instance)          private void CreateParser(XMLTVRuntimeInstance instance)
92          {          {
93              XMLTVParser parser = new XMLTVParser(instance);              //XMLTVParser parser = new XMLTVParser(instance);
94                XMLTVParser.CreateInstance(instance);
95            }
96    
97            public void Dispose()
98            {
99                //throw new NotImplementedException();
100          }          }
101      }      }
102  }  }

Legend:
Removed from v.36  
changed lines
  Added in v.52

  ViewVC Help
Powered by ViewVC 1.1.22