public void GenerateObserver(TypeContext typeContext) { var registerMethods = typeContext.OnlyMethodsWithAttribute(typeof(RegisterObserverAttribute)); var observerInterfaces = new List <Type>(); registerMethods.ClassMethodList.Values.ToList().ForEach(m => { var parameterType = m.First().GetParameters().First().ParameterType; if (!parameterType.IsInterface) { throw new ArgumentException("Parameter is no interface"); } observerInterfaces.Add(parameterType); }); _observerProxies = observerInterfaces.Select(ObserverProxy.Create).ToList(); }
public void GenerateCommands(TypeContext typeContext) { var onlyMethodsWithAttribute = typeContext.OnlyMethodsWithAttribute(typeof(InvokeCommandAttribute)); var invokerInterfaces = new List <Type>(); onlyMethodsWithAttribute.ClassMethodList.Values.ToList().ForEach(m => { var parameterType = m.First().GetParameters().First().ParameterType; if (!parameterType.IsInterface) { throw new ArgumentException("Parameter is no interface"); } invokerInterfaces.Add(parameterType); }); _commands = invokerInterfaces.Select(CommandProxy.Create).ToList(); }