28 lines
800 B
C#
28 lines
800 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Encompass.Exceptions;
|
|
|
|
namespace Encompass
|
|
{
|
|
[AttributeUsage(AttributeTargets.Class)]
|
|
public class ReadsPending : Attribute
|
|
{
|
|
public readonly HashSet<Type> readPendingTypes = new HashSet<Type>();
|
|
|
|
public ReadsPending(params Type[] readPendingTypes)
|
|
{
|
|
foreach (var readPendingType in readPendingTypes)
|
|
{
|
|
var isComponent = readPendingType.GetInterfaces().Contains(typeof(IComponent));
|
|
|
|
if (!isComponent)
|
|
{
|
|
throw new IllegalReadTypeException("{0} must be a Component", readPendingType.Name);
|
|
}
|
|
|
|
this.readPendingTypes.Add(readPendingType);
|
|
}
|
|
}
|
|
}
|
|
} |