mirror of
https://github.com/jackqqq123/luban_ui_internal.git
synced 2025-11-15 13:48:24 +08:00
29 lines
1021 B
C#
29 lines
1021 B
C#
|
|
using System;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Reflection;
|
||
|
|
using LubanHub.Core.Attributes;
|
||
|
|
|
||
|
|
// 简单的测试脚本来验证配置发现
|
||
|
|
Console.WriteLine("检查程序集加载情况...");
|
||
|
|
|
||
|
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
||
|
|
.Where(a => !a.IsDynamic && a.GetName().Name?.StartsWith("LubanHub") == true)
|
||
|
|
.ToList();
|
||
|
|
|
||
|
|
Console.WriteLine($"发现 {assemblies.Count} 个LubanHub程序集:");
|
||
|
|
foreach (var assembly in assemblies)
|
||
|
|
{
|
||
|
|
Console.WriteLine($" - {assembly.GetName().Name}");
|
||
|
|
|
||
|
|
var configTypes = assembly.GetTypes()
|
||
|
|
.Where(type => type.IsClass && !type.IsAbstract &&
|
||
|
|
type.GetCustomAttribute<ConfigurationSectionAttribute>() != null)
|
||
|
|
.ToList();
|
||
|
|
|
||
|
|
Console.WriteLine($" 配置类型数量: {configTypes.Count}");
|
||
|
|
foreach (var configType in configTypes)
|
||
|
|
{
|
||
|
|
var attr = configType.GetCustomAttribute<ConfigurationSectionAttribute>();
|
||
|
|
Console.WriteLine($" - {configType.Name}: {attr?.DisplayName}");
|
||
|
|
}
|
||
|
|
}
|