private void LoadSignatureTypes()
 {
     /*
      * SignatureTypes =
      * Get all loaded assemblies. Then,
      * Get all Types from them. Then,
      * Get the ones that are classes and not abstract. Then,
      * Get the ones that extend SignatureFileNode<>. Then,
      * Organize them by the base type and signature class. Then, finally,
      * Make a dictionary out of it for future lookups.
      */
     SignatureTypes = AppDomain.CurrentDomain.GetAssemblies()
                      .SelectMany(c => c.GetTypes())
                      .Where(t => t.IsClass && !t.IsAbstract)
                      .Where(t => t.IsSubclassOfRawGeneric(typeof(SignatureFileNode <>)))
                      .Select(c => (BaseType: c, SignatureClass: c.BaseType?.GetGenericArguments().FirstOrDefault()))
                      .Select(c => (c.BaseType,
                                    TryDelegate: SignatureParserHelper.GetTryParseDelegateForType(c.SignatureClass)))
                      .ToDictionary(c => c.BaseType, c => c.TryDelegate);
 }
Ejemplo n.º 2
0
        public void CanGetDelegateForFunctionSignature()
        {
            var del = SignatureParserHelper.GetTryParseDelegateForType(typeof(FunctionSignature));

            Assert.NotNull(del);
        }