private static void LoadSymbioteDependencies(Assembly assembly, List <Type> initializers) { if (ScanIndex.ConfiguredSymbiotes[assembly]) { return; } var dependencies = GetDependencies(assembly); dependencies.ForEach(x => LoadSymbioteDependencies(x, initializers)); var scanInstructionType = ScanIndex.ScanningInstructions.FirstOrDefault(x => x.Assembly.Equals(assembly)); var dependencyDefinitionType = ScanIndex.DependencyDefinitions.FirstOrDefault(x => x.Assembly.Equals(assembly)); var scanInstructions = scanInstructionType != null ? Activator.CreateInstance(scanInstructionType) as IProvideScan : null; var dependencyDefinitions = dependencyDefinitionType != null ? Activator.CreateInstance(dependencyDefinitionType) as IDefineDependencies : null; Assimilation.Dependencies(x => { if (scanInstructions != null) { x.Scan(scanInstructions.Scan()); } if (dependencyDefinitions != null) { dependencyDefinitions.Dependencies()(x); } }); ScanIndex.ConfiguredSymbiotes[assembly] = true; var initializerType = ScanIndex.SymbioteInitializers.FirstOrDefault(x => x.Assembly.Equals(assembly)); if (initializerType != null) { initializers.Add(initializerType); } }
static Assimilate() { Assimilation = new Assimilation(); ScanIndex = new ScanIndex(); ScanIndex.Start(); }