using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Torch.API.Plugins
{
///
/// Indicates that the given type should be loaded by the plugin manager as a plugin.
///
[AttributeUsage(AttributeTargets.Class)]
public class PluginAttribute : Attribute
{
///
/// The display name of the plugin
///
public string Name { get; }
///
/// The version of the plugin
///
public Version Version { get; }
///
/// The GUID of the plugin
///
public Guid Guid { get; }
///
/// Creates a new plugin attribute with the given attributes
///
///
///
///
public PluginAttribute(string name, string version, string guid)
{
Name = name;
Version = Version.Parse(version);
Guid = Guid.Parse(guid);
}
///
/// Creates a new plugin attribute with the given attributes. Version is computed as the version of the assembly containing the given type.
///
///
/// Version is this type's assembly's version
///
public PluginAttribute(string name, Type versionSupplier, string guid)
{
Name = name;
Version = versionSupplier.Assembly.GetName().Version;
Guid = Guid.Parse(guid);
}
}
}