46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
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();
|
|
}
|
|
} |