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