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;

namespace HyperCube
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Utils.AdvConsole.Initialize();
            System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;

            CreateHostBuilder(args).Build().Run();
        }

        private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex = (Exception)e.ExceptionObject;
            Utils.AdvConsole.WriteLine($"UNHANDLED EXCEPTION: {ex.GetType()}\r\n{ex.Message}\r\n{ex.StackTrace}");
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>().UseUrls("http://localhost:85/");
                    
                });
    }
}
