Initial_commit_SecMPS_v2

This commit is contained in:
2026-05-15 23:22:48 +08:00
commit 23ea4fe05f
13830 changed files with 298675 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace VolPro.Core.Controllers.DynamicController
{
public class AddControllerChangeProvider : IActionDescriptorChangeProvider
{
public static AddControllerChangeProvider Instance { get; } = new AddControllerChangeProvider();
public CancellationTokenSource TokenSource { get; private set; }
public bool HasChanged { get; set; }
public IChangeToken GetChangeToken()
{
TokenSource = new CancellationTokenSource();
return new CancellationChangeToken(TokenSource.Token);
}
}
}

View File

@@ -0,0 +1,52 @@
using VolPro.Core.Configuration;
using VolPro.Core.Extensions;
using VolPro.Entity.SystemModels;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace VolPro.Core.Controllers.DynamicController
{
public class ChangeActionService : IHostedService
{
private readonly ApplicationPartManager Part;
private readonly IWebHostEnvironment _environment;
public ChangeActionService(IServiceScopeFactory scope, IWebHostEnvironment env)
{
Part = scope.CreateScope().ServiceProvider.GetService<ApplicationPartManager>();
_environment = env;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
//string rootPath = (_environment.ContentRootPath + "\\plugs").ReplacePath();
//foreach (var item in Directory.GetFiles(rootPath).Where(x => x.EndsWith(".dll")))
//{
// string path = ($"{item}").ReplacePath();
// //assemblyList.Add(Assembly.LoadFile(path));
// var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(path);
// var assemblyPart = new AssemblyPart(assembly);
// Part.ApplicationParts.Add(assemblyPart);
//}
//AddControllerChangeProvider.Instance.HasChanged = true;
//AddControllerChangeProvider.Instance.TokenSource?.Cancel();
await Task.CompletedTask;
}
public async Task StopAsync(CancellationToken cancellationToken)
{
await Task.CompletedTask;
}
}
}