51 lines
1.0 KiB
C#
51 lines
1.0 KiB
C#
using Microsoft.AspNetCore.StaticFiles;
|
|
using Microsoft.Extensions.Configuration;
|
|
using SqlSugar;
|
|
|
|
namespace ACBuildService;
|
|
|
|
public static class App
|
|
{
|
|
public static bool Running { get; set; }
|
|
public static AppSettingsConfigs Settings = new AppSettingsConfigs();
|
|
|
|
|
|
public static void Init()
|
|
{
|
|
Running = true;
|
|
LoadSetting();
|
|
DB.InitDb();
|
|
}
|
|
|
|
public static void LoadSetting()
|
|
{
|
|
var configuration = new ConfigurationBuilder()
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
|
.Build();
|
|
|
|
var config = configuration.Get<AppSettingsConfigs>(); //绑定到实体
|
|
if (config != null)
|
|
{
|
|
Settings = config;
|
|
}
|
|
else
|
|
{
|
|
throw new IOException("配置文件读取失败");
|
|
}
|
|
}
|
|
|
|
|
|
#region Update
|
|
|
|
internal static void Update()
|
|
{
|
|
Time.Update();
|
|
}
|
|
|
|
internal static void LateUpdate()
|
|
{
|
|
Time.LateUpdate();
|
|
}
|
|
|
|
#endregion
|
|
} |