Esempio n. 1
0
        private void RegisterDerivedTypes()
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToAssemblyDefinition().Where(assembly =>
                                                                                                  new[] { "System", "DevExpress" }.All(s => !assembly.Name.Name.StartsWith(s)));
            var types = assemblies.SelectMany(assembly => assembly.MainModule.Types);
            var additionExportedTypeDefinitions = AdditionalExportedTypes.GroupBy(type => AssemblyDefinition.ReadAssembly(type.Assembly.Location))
                                                  .SelectMany(grouping => grouping.Key.MainModule.Types.Where(definition =>
                                                                                                              AdditionalControllerTypes.Select(type => type).Any(type => type.FullName == definition.FullName)))
                                                  .Where(definition => definition.Namespace != null && definition.Namespace.StartsWith(BaseImplNameSpace)).ToArray();

            types = types.Where(type =>
                                type.Module.Assembly.FullName != BaseImplAssembly.FullName && additionExportedTypeDefinitions.Any(type.IsSubclassOf));
            foreach (var type in types)
            {
                WorldCreatorTypeInfoSource.Instance.ForceRegisterEntity(AppDomain.CurrentDomain.FindType(type));
            }
        }