using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Xml.Linq; using libxmltv.Core; using System.ComponentModel; using System.Collections; using System.Runtime.InteropServices; namespace libxmltv.Interfaces { //public interface IXMLTVLoader //{ // FileInfo XmlFile { get; } // string XmlDoc { get; } //} //public interface IXMLTVParser //{ // IXMLTVSource Source { get; } // Dictionary Channels { get; } // Dictionary Programs { get; } //} public interface IXMLTVSource { string SourceName { get; } string GeneratorName { get; } string GeneratorUrl { get; } string ToString(); } public interface IXMLTVChannel { string Id { get; } int Number { get; } string CallSign { get; } string Name { get; } string ToString(); } public interface IXMLTVProgram { PropertyDictionary MetaData { get; } } public interface IXMLTVProgramCollection : IXMLTVDictionaryCollection { } public interface IXMLTVChannelCollection : IXMLTVDictionaryCollection { } public interface IXMLTVDictionaryCollection { Dictionary Collection { get; } } public interface IXMLTVListCollection { List Collection { get; } } public interface IXMLTVHandler : IXMLTVHandler { } public interface IXMLTVHandler { T Handler { get; } } //public interface IXMLTVBase : IXMLTVBase { } public interface IXMLTVBase : IGetInstance, IXMLTVHandler { } public interface IXMLTVRuntimeInstance : IOnInstanceCreated { bool IsAborting { get; } //FileInfo XmlFile { get; } string XmlFile_Name { get; } string XmlFile_FullName { get; } string XmlDoc { get; } IXMLTVSource Source { get; } List Channels { get; } List Programs { get; } } public interface IXMLTVSerializer : IXMLTVSerializer { } public interface IXMLTVSerializer { bool Serialize(string file); bool Serialize(Stream stream); T DeSerialize(string file, out bool status); T DeSerialize(Stream stream, out bool status); } public interface IXMLTV : IXMLTV where CLASS : class,INTERFACE { } public interface IXMLTV : IXMLTVSerializer, IDestroyInstance, IOnInstanceCreated, IGetInstance where CLASS : class,INTERFACE where INSTANCECREATED_EVENTAGS : EventArgs { } public interface IInstance : IInstance { } public interface IInstance { T Instance { get; set; } } public interface ICreateSerializer : ICreateSerializer { } public interface ICreateSerializer { IXMLTVSerializer CreateSerializer(); } //public interface IGetInstanceT : IGetInstanceT { } //public interface IGetInstanceT { T GetInstance(); } public interface IGetInstance : IGetInstance { } public interface IGetInstance { T GetInstance(); } public interface IOnInstanceCreated : IOnInstanceCreated { } public interface IOnInstanceCreated where T : EventArgs { EventHandler OnInstanceCreated { get; set; } } public interface ISerializer { IXMLTVSerializer Serializer { get; } } public interface IDestroyInstance { void DestroyInstance(); } public interface IGetCreatedInstanceEvent : IGetCreatedInstanceEvent { } public interface IGetCreatedInstanceEvent where T : EventArgs { EventHandler GetOnInstanceCreated(); } public interface ISetCreatedInstanceEvent : ISetCreatedInstanceEvent { } public interface ISetCreatedInstanceEvent where T : EventArgs { void SetOnInstanceCreated(EventHandler event_instance); } public interface IRuntimeInstanceLoader : IRuntimeInstanceLoader { } public interface IRuntimeInstanceLoader { T LoadFromInstance(T instance); } #region Property Dictionary support public interface IPropertyDictionary : IPropertyDictionary { } public interface IPropertyDictionary : IPropertyCollection>, IEnumerable>, IEnumerable { IPropertyCollection PropertyKeys { get; } IPropertyCollection PropertyValues { get; } TValue this[TKey key] { get; set; } void AddProperty(TKey key, TValue value); bool ContainsProperty(TKey key); bool RemoveProperty(TKey key); bool TryGetPropertyValue(TKey key, out TValue value); } public interface IPropertyCollection : IEnumerable, IEnumerable { int PropertyCount { get; } bool IsReadOnly { get; } void AddProperty(T item); void ClearProperties(); bool ContainsProperty(T item); void CopyPropertiesTo(T[] array, int arrayIndex); bool RemoveProperty(T item); } #endregion #region Property List support public interface IPropertyList : IPropertyList> { } public interface IPropertyList : IPropertyCollection, IEnumerable>, IEnumerable { T this[int index] { get; set; } int IndexOfProperty(T item); void InsertPropertyAtIndex(int index, T item); void RemovePropertyAt(int index); } #endregion #region PropertyValuePair support public struct PropertyValuePair { #region KeyValuePair support public static implicit operator PropertyValuePair(KeyValuePair i) { return new PropertyValuePair(i.Key, i.Value); } public static implicit operator KeyValuePair(PropertyValuePair i) { return new KeyValuePair(i.Name, i.Value); } #endregion public PropertyValuePair(TKey name, TValue value) { this.name = name; this.value = value; } private TKey name; public TKey Name { get { return this.name; } } private TValue value; public TValue Value { get { return this.value; } } public override string ToString() { StringBuilder builder = new StringBuilder(); builder.Append('['); if (this.Name != null) { builder.Append(this.Name.ToString()); } builder.Append(", "); if (this.Value != null) { builder.Append(this.Value.ToString()); } builder.Append(']'); return builder.ToString(); } } #endregion }