26 lines
779 B
C#
26 lines
779 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Encompass.Exceptions;
|
|
|
|
namespace Encompass
|
|
{
|
|
public class Activates : Attribute
|
|
{
|
|
public readonly HashSet<Type> activateTypes = new HashSet<Type>();
|
|
|
|
public Activates(params Type[] activateTypes)
|
|
{
|
|
foreach (var activateType in activateTypes)
|
|
{
|
|
var isComponent = activateType.GetInterfaces().Contains(typeof(IComponent));
|
|
if (!isComponent)
|
|
{
|
|
throw new IllegalActivateTypeException("{0} must be a Component", activateType.Name);
|
|
}
|
|
|
|
this.activateTypes.Add(typeof(PendingComponentMessage<>).MakeGenericType(activateType));
|
|
}
|
|
}
|
|
}
|
|
} |