ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/xmltv_parser/trunk/libxmltv/Core/XMLTV.cs
(Generate patch)

Comparing trunk/libxmltv/Core/XMLTV.cs (file contents):
Revision 53 by william, Fri Mar 8 07:05:53 2013 UTC vs.
Revision 54 by william, Fri Mar 8 08:51:10 2013 UTC

# Line 31 | Line 31 | namespace libxmltv.Core
31          public static IXMLTVRuntimeInstance DeSerialize(string file, out bool status) { return instance.DeSerialize(file, out status); }
32          public static IXMLTVRuntimeInstance DeSerialize(Stream stream, out bool status) { return instance.DeSerialize(stream, out status); }
33          #endregion
34 +
35 +        public static void DestroyInstance() { instance.DestroyInstance(); }
36 +
37 +        public static EventHandler<EventArgs> OnInstanceCreated
38 +        {
39 +            get { return instance.OnInstanceCreated; }
40 +            set { instance.OnInstanceCreated = value; }
41 +        }
42      }
43  
44 <    internal class XMLTV<INTERFACE, CLASS> : IXMLTV<INTERFACE, CLASS> where CLASS : class,INTERFACE
44 >    internal class XMLTV<INTERFACE, CLASS> : IDestroyInstance, IXMLTV<INTERFACE, CLASS> where CLASS : class,INTERFACE
45      {
46 +    
47          public XMLTV(params object[] args)
48          {
49              
# Line 88 | Line 97 | namespace libxmltv.Core
97          public INTERFACE DeSerialize(string file, out bool status) { return CreateSerializer().DeSerialize(file, out status); }
98          public INTERFACE DeSerialize(Stream stream, out bool status) { return CreateSerializer().DeSerialize(stream, out status); }
99          #endregion
100 +        public void DestroyInstance()
101 +        {
102 +            IDestroyInstance destoyer = (instance as IDestroyInstance);
103 +            if (destoyer != null)
104 +            {
105 +                destoyer.DestroyInstance();
106 +            }
107 +            else
108 +            {
109 +                xmltv_logger.Log.Error.WriteLine("Unable to call DestroyInstance() on type: '{0}'", instance.GetType().Name);
110 +            }            
111 +        }
112 +        private void SetOnInstanceCreated(EventHandler<EventArgs> event_instance)
113 +        {
114 +            ISetCreatedInstanceEvent setter = (instance as ISetCreatedInstanceEvent);
115 +            if (setter != null) { setter.SetOnInstanceCreated(event_instance); }
116 +        }
117 +        private EventHandler<EventArgs> GetOnInstanceCreated()
118 +        {
119 +            IGetCreatedInstanceEvent getter = (instance as IGetCreatedInstanceEvent);
120 +            if (getter != null) { return getter.GetOnInstanceCreated(); }
121 +            return null;
122 +        }
123 +        public EventHandler<EventArgs> OnInstanceCreated
124 +        {
125 +            get { return GetOnInstanceCreated(); }
126 +            set { SetOnInstanceCreated(value); }
127 +        }
128      }
129  
130   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines