summaryrefslogtreecommitdiff
path: root/Impostor-dev/src/Impostor.Server/Plugins/PluginInformation.cs
blob: e6a5b6c81f06d6b9f8d92281ff9046e3186ecfa3 (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
using System;
using System.Reflection;
using Impostor.Api.Plugins;

namespace Impostor.Server.Plugins
{
    public class PluginInformation
    {
        private readonly ImpostorPluginAttribute _attribute;

        public PluginInformation(IPluginStartup startup, Type pluginType)
        {
            _attribute = pluginType.GetCustomAttribute<ImpostorPluginAttribute>();

            Startup = startup;
            PluginType = pluginType;
        }

        public string Package => _attribute.Package;

        public string Name => _attribute.Name;

        public string Author => _attribute.Author;

        public string Version => _attribute.Version;

        public IPluginStartup Startup { get; }

        public Type PluginType { get; }

        public IPlugin Instance { get; set; }

        public override string ToString()
        {
            return $"{Package} {Name} ({Version}) by {Author}";
        }
    }
}