aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Plugins/BaseConfigurationPage.cs
blob: dc9405840a3b460ec63bd2fd688131bf2f39c550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using MediaBrowser.Common.Plugins;
using System.IO;

namespace MediaBrowser.Controller.Plugins
{
    /// <summary>
    /// Class BaseConfigurationPage
    /// </summary>
    public abstract class BaseConfigurationPage
    {
        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>The name.</value>
        public abstract string Name { get; }

        /// <summary>
        /// Gets the description.
        /// </summary>
        /// <value>The description.</value>
        public virtual string Description
        {
            get { return string.Empty; }
        }

        /// <summary>
        /// Gets the type of the configuration page.
        /// </summary>
        /// <value>The type of the configuration page.</value>
        public virtual ConfigurationPageType ConfigurationPageType
        {
            get { return ConfigurationPageType.PluginConfiguration; }
        }

        /// <summary>
        /// Gets the HTML stream from manifest resource.
        /// </summary>
        /// <param name="resource">The resource.</param>
        /// <returns>Stream.</returns>
        protected Stream GetHtmlStreamFromManifestResource(string resource)
        {
            return GetType().Assembly.GetManifestResourceStream(resource);
        }

        /// <summary>
        /// Gets the HTML stream.
        /// </summary>
        /// <returns>Stream.</returns>
        public abstract Stream GetHtmlStream();

        /// <summary>
        /// Gets the name of the plugin.
        /// </summary>
        /// <value>The name of the plugin.</value>
        public virtual string OwnerPluginName
        {
            get { return GetOwnerPlugin().Name; }
        }
        
        /// <summary>
        /// Gets the owner plugin.
        /// </summary>
        /// <returns>BasePlugin.</returns>
        public abstract IPlugin GetOwnerPlugin();
    }

    /// <summary>
    /// Enum ConfigurationPageType
    /// </summary>
    public enum ConfigurationPageType
    {
        /// <summary>
        /// The plugin configuration
        /// </summary>
        PluginConfiguration,
        /// <summary>
        /// The none
        /// </summary>
        None
    }
}