提交功能

This commit is contained in:
Bob.Song
2026-02-08 16:58:32 +08:00
commit 9dd1e6c278
67 changed files with 4588 additions and 0 deletions

60
Program.cs Normal file
View File

@@ -0,0 +1,60 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;
using ACBuildService;
public class Program
{
private static volatile Task _loopTask;
private static volatile Task _shutDownTask;
public static async Task Main(string[] args)
{
App.Init();
Test();
await HttpService.Start();
ExitHandle();
_loopTask = EnterAsync();
await _loopTask;
}
private static async Task EnterAsync()
{
while (App.Running)
{
await Task.Delay(10);
App.Update();
App.LateUpdate();
}
Log.Info("Stop");
}
private static void ExitHandle()
{
//退出监听
AppDomain.CurrentDomain.ProcessExit += (_, _) => { ServerExitConfirm(); };
//Fetal异常监听
AppDomain.CurrentDomain.UnhandledException += (_, e) => { ServerExitConfirm(); };
//ctrl+c
Console.CancelKeyPress += (_, _) => { ServerExitConfirm(); };
}
private static void ServerExitConfirm()
{
Log.Info("开始执行退出程序");
_shutDownTask = Task.Run(() =>
{
App.Running = false;
_loopTask?.Wait();
Console.WriteLine("退出完成");
Process.GetCurrentProcess().Kill();
});
_shutDownTask.Wait();
}
private static void Test()
{
}
}