public PluginCollector(PluginTable pluginTable) { //collect 内置插件 var currDir = AppContext.BaseDirectory; var getTargetPluginDll = Directory.GetFiles(currDir, "Taiji.*.dll"); foreach (var dllItem in getTargetPluginDll) { var ass = Assembly.LoadFile(dllItem); var assTypes = ass.GetTypes(); var bootloaderType = assTypes.Where(x => x.GetInterfaces().Contains(typeof(IServiceBootloader))).FirstOrDefault(); if (bootloaderType == null) { continue; } var bootloader = (IServiceBootloader)Activator.CreateInstance(bootloaderType); pluginTable.Add(bootloader.Name, new PluginItem { Name = bootloader.Name, Description = bootloader.Description, Icon = bootloader.Icon, Version = bootloader.Version, ServiceBackendUrl = bootloader.ServiceBackendUrl, ServiceFrontendUrl = bootloader.ServiceFrontendUrl, Bootloader = bootloader }); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/build"; }); var pt = new PluginTable(); services.AddSingleton <PluginTable>(pt); services.AddSingleton <PluginServiceCollection>(); var plugin = new PluginCollector(pt); }