mirror of
				https://github.com/snltty/linker.git
				synced 2025-10-31 12:36:48 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using cmonitor.config;
 | |
| using cmonitor.startup;
 | |
| using common.libs;
 | |
| using Microsoft.Extensions.DependencyInjection;
 | |
| using System.Reflection;
 | |
| 
 | |
| namespace cmonitor.api
 | |
| {
 | |
|     public sealed class ApiStartup : IStartup
 | |
|     {
 | |
|         public void AddClient(ServiceCollection serviceCollection, Config config, Assembly[] assemblies)
 | |
|         {
 | |
|         }
 | |
| 
 | |
|         public void AddServer(ServiceCollection serviceCollection, Config config, Assembly[] assemblies)
 | |
|         {
 | |
|             serviceCollection.AddSingleton<IApiServer, ApiServer>();
 | |
|         }
 | |
| 
 | |
|         public void UseClient(ServiceProvider serviceProvider, Config config, Assembly[] assemblies)
 | |
|         {
 | |
|         }
 | |
| 
 | |
|         public void UseServer(ServiceProvider serviceProvider, Config config, Assembly[] assemblies)
 | |
|         {
 | |
|             Logger.Instance.Info($"start api server");
 | |
|             IApiServer clientServer = serviceProvider.GetService<IApiServer>();
 | |
|             clientServer.LoadPlugins(assemblies);
 | |
|             clientServer.Websocket();
 | |
|             Logger.Instance.Info($"api listen:{config.Data.Server.ApiPort}");
 | |
|         }
 | |
|     }
 | |
| }
 | 
