submodule对gitea不管用,所以直接拉了一份拉格兰
This commit is contained in:
46
Lagrange.Core/Lagrange.OneBot/Program.cs
Normal file
46
Lagrange.Core/Lagrange.OneBot/Program.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime;
|
||||
using System.Text;
|
||||
using Lagrange.OneBot.Extensions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Lagrange.OneBot;
|
||||
|
||||
internal abstract class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
string version = Assembly.GetAssembly(typeof(Program))?
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||
.InformationalVersion ?? "Unknown Lagrange.OneBot Version";
|
||||
Console.WriteLine($"Lagrange.OneBot Version: {version}\n");
|
||||
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
Console.InputEncoding = Encoding.UTF8;
|
||||
|
||||
GCSettings.LatencyMode = GCLatencyMode.Batch;
|
||||
|
||||
if (!File.Exists("appsettings.json"))
|
||||
{
|
||||
Console.WriteLine("No exist config file, create it now...");
|
||||
|
||||
var assm = Assembly.GetExecutingAssembly();
|
||||
using var istr = assm.GetManifestResourceStream("Lagrange.OneBot.Resources.appsettings.json")!;
|
||||
using var temp = File.Create("appsettings.json");
|
||||
istr.CopyTo(temp);
|
||||
|
||||
istr.Close();
|
||||
temp.Close();
|
||||
|
||||
Console.WriteLine("Please Edit the appsettings.json to set configs and press any key to continue");
|
||||
Console.ReadKey(true);
|
||||
}
|
||||
|
||||
Host.CreateApplicationBuilder()
|
||||
.ConfigureLagrangeCore()
|
||||
.ConfigureOneBot()
|
||||
.Build()
|
||||
.InitializeMusicSigner() // Very ugly (
|
||||
.Run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user