27 lines
756 B
C#
27 lines
756 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Encompass.Exceptions;
|
|
|
|
namespace Encompass
|
|
{
|
|
[System.AttributeUsage(System.AttributeTargets.Class)]
|
|
public class Reads : System.Attribute
|
|
{
|
|
public readonly List<Type> readTypes;
|
|
|
|
public Reads(params Type[] readTypes)
|
|
{
|
|
foreach (var readType in readTypes)
|
|
{
|
|
if (!readType.GetInterfaces().Contains(typeof(IMessage)) && !readType.GetInterfaces().Contains(typeof(IComponent)))
|
|
{
|
|
throw new IllegalReadTypeException("{0} must be a Message or Component", readType.Name);
|
|
}
|
|
}
|
|
|
|
this.readTypes = new List<Type>(readTypes);
|
|
}
|
|
}
|
|
}
|