using Quasar.Server.Forms;
using System;
using System.IO;
using System.Net;
using System.Reflection;
using System.Windows.Forms;

namespace Quasar.Server
{
    internal static class Program
    {
        [STAThread]
        private static void Main()
        {
            // .NET Framework can't probe loose DLLs for resource deserialization;
            // load System.Resources.Extensions from the exe directory manually.
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
            {
                var name = new AssemblyName(args.Name).Name + ".dll";
                var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, name);
                return File.Exists(path) ? Assembly.LoadFrom(path) : null;
            };

            // enable TLS 1.2
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
    }
}
