using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; namespace Filter.Handlers.Instances { internal class FilterAssembly { public FilterAssembly() { } public static IEnumerable> FindHandlers() where PacketAttribute : Attribute { return ( from Assembly in AppDomain.CurrentDomain.GetAssemblies() where !Assembly.GlobalAssemblyCache select Assembly).SelectMany((System.Reflection.Assembly Types) => Types.GetTypes()).SelectMany((Type Methods) => Methods.GetMethods()).Select((MethodInfo Method) => new { Method = Method, CustomAttribute = (PacketAttribute)(Attribute.GetCustomAttribute(Method, typeof(PacketAttribute), false) as PacketAttribute) }).Where((argument0) => argument0.CustomAttribute != null).Select((argument1) => new Combine(argument1.CustomAttribute, argument1.Method)); } } }