using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Serilog; using Serilog.Events; using Serilog.Formatting.Json; using Serilog.Configuration; namespace WarmlyShip { internal static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { ApplicationConfiguration.Initialize(); string[] path = Directory.GetCurrentDirectory().Split('\\'); string pathNeed = ""; for (int i = 0; i < path.Length - 3; i++) { pathNeed += path[i] + "\\"; } var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(path: $"{pathNeed}appsettings.json", optional: false, reloadOnChange: true) .Build(); Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(configuration) .CreateLogger(); Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormShipCollection()); } } }