You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.6 KiB
44 lines
1.6 KiB
1 month ago
|
using Sog;
|
||
|
using System;
|
||
|
using System.Linq;
|
||
|
using System.Reflection;
|
||
|
|
||
|
namespace CheckConfig
|
||
|
{
|
||
|
public class Program
|
||
|
{
|
||
|
private readonly static string[] configOrder = new string[] { "常规","系统" };
|
||
|
public static void Main(string[] args)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
AppTime appTime = new AppTime();
|
||
|
appTime.UpdateTime();
|
||
|
TraceLog.SetLogPathName("../checklog/", "checkconfig");
|
||
|
CheckConfigStrategyFactory.InitConfigDef("../checkConfigDef.json");
|
||
|
|
||
|
Type[] types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(InitializingConfig)))).ToArray();
|
||
|
foreach (Type item in types)
|
||
|
{
|
||
|
Object obj = Activator.CreateInstance(item);
|
||
|
MethodInfo meth = item.GetMethod("AfterPropertiesSet");
|
||
|
meth.Invoke(obj, null);
|
||
|
}
|
||
|
ConsoleStyle consoleStyle = new ConsoleStyle(configOrder);
|
||
|
foreach (var item in configOrder)
|
||
|
{
|
||
|
ConfigStrategy configStrategy = CheckConfigStrategyFactory.GetConfigStrategy(item);
|
||
|
configStrategy.CheckConfigAlgorithm();
|
||
|
}
|
||
|
consoleStyle.ConsoleStrateMsg();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
Console.WriteLine("检测错误信息:" + ex.Message);
|
||
|
Console.WriteLine(ex.StackTrace);
|
||
|
Console.WriteLine(ex);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|