CodeLiturgy.Dashboard/BlueWest.Api/Program.cs

61 lines
2.2 KiB
C#

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BlueWest.Collections;
using BlueWest.Core;
using BlueWest.Tools;
namespace BlueWest.WebApi
{
public class Program
{
public static readonly EventManager EventManager =
new EventManager(new FastDictionary<Type, FastList<EventListenerBase>>(10000));
private static ThreadServer _threadServer;
/*private static CSharpCompilation GenerateCode(string sourceCode)
{
var codeString = SourceText.From(sourceCode);
var parsedSyntaxTree = SyntaxFactory.ParseSyntaxTree(codeString, CSharpParseOptions.Default);
return CSharpCompilation.Create("Hello.dll",
new[] { parsedSyntaxTree },
references: ReferenceAssemblies.Net50, // install jared's Basic.Reference.Assemblies for this, otherwise, you are going to manually add the DLLs you want
options: new CSharpCompilationOptions(OutputKind.ConsoleApplication,
optimizationLevel: OptimizationLevel.Release));
}*/
public static IHost Host1 { get; private set; }
public static void Main(string[] args)
{
Host1 = CreateHostBuilder(args).Build();
Host1.RunAsync();
System.Threading.Thread.Sleep(2500);
_threadServer = new ThreadServer(EventManager);
BlueWestConsoleBanner();
_threadServer.Init();
}
private static void BlueWestConsoleBanner()
{
Console.WriteLine(" |------------------------------«");
Console.WriteLine(" » Blue West «");
Console.WriteLine(" |------------------------------«\n");
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}