[AttributeUsage(AttributeTargets.Class)]
public class ImpostorPluginAttribute : Attribute
{
+ public ImpostorPluginAttribute(string id)
+ {
+ Id = id;
+ }
+
public ImpostorPluginAttribute(string id, string name, string author, string version)
{
Id = id;
public string Id { get; }
- public string Name { get; }
+ public string? Name { get; }
- public string Author { get; }
+ public string? Author { get; }
- public string Version { get; }
+ public string? Version { get; }
}
}
namespace Impostor.Plugins.Debugger
{
- [ImpostorPlugin("gg.impostor.debugger", "Debugger", "Gerard", "1.0.0")]
+ [ImpostorPlugin("gg.impostor.debugger")]
public class DebugPlugin : PluginBase
{
}
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Library</OutputType>
+
+ <Version>1.0.0</Version>
+ <AssemblyTitle>Debugger</AssemblyTitle>
+ <Authors>Gerard</Authors>
</PropertyGroup>
<ItemGroup>
namespace Impostor.Plugins.Example
{
- [ImpostorPlugin("gg.impostor.example", "Example", "AeonLucid", "1.0.0")]
+ [ImpostorPlugin("gg.impostor.example")]
public class ExamplePlugin : PluginBase
{
private readonly ILogger<ExamplePlugin> _logger;
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
+
+ <Version>1.0.0</Version>
+ <AssemblyTitle>Example</AssemblyTitle>
+ <Authors>AeonLucid</Authors>
</PropertyGroup>
<ItemGroup>
{
_attribute = pluginType.GetCustomAttribute<ImpostorPluginAttribute>()!;
+ var assembly = pluginType.Assembly;
+ Name = _attribute.Name ?? assembly.GetCustomAttribute<AssemblyTitleAttribute>()?.Title ?? assembly.GetName().Name!;
+ Author = _attribute.Author ?? assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company ?? string.Empty;
+ Version = _attribute.Version ?? assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? assembly.GetName().Version!.ToString();
+
Dependencies = pluginType.GetCustomAttributes<ImpostorDependencyAttribute>().Select(t => new DependencyInformation(t)).ToList();
Startup = startup;
PluginType = pluginType;
public string Id => _attribute.Id;
- public string Name => _attribute.Name;
+ public string Name { get; }
- public string Author => _attribute.Author;
+ public string Author { get; }
- public string Version => _attribute.Version;
+ public string Version { get; }
public List<DependencyInformation> Dependencies { get; }