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