static void Main()
        {
            using (var mut = new Mutex(true, MutexName, out bool createdNew))
            {
                if (!createdNew)
                {
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                WebRequest.DefaultCachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
#if !DEBUG
                System.Net.WebRequest.DefaultWebProxy = null;
#endif

                CrashReport.Init();

                if (!Certificates.InstallCACertificates())
                {
                    MessageBox.Show(Lang.CertificateError, Lang.Name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                Config.Load();
                using (var context = new MainContext())
                {
                    Application.Run(context);
                    Config.Save();
                }
            }
        }
        static void Main()
        {
            using (var mut = new Mutex(true, MutexName, out bool createdNew))
            {
                if (!createdNew)
                {
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                WebRequest.DefaultCachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
#if !DEBUG
                System.Net.WebRequest.DefaultWebProxy = null;
#endif

                CrashReport.Init();

                if (Assembly.GetExecutingAssembly().GetName().Version.ToString() != "0.0.0.0" && !CheckUpdate())
                {
                    return;
                }

                if (!Certificates.InstallCACertificates())
                {
                    MessageBox.Show(Lang.CertificateError, Lang.Name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                RespiratorServer server;
                try
                {
                    server = new RespiratorServer();
                }
                catch (Exception ex)
                {
                    SentrySdk.CaptureException(ex);

                    MessageBox.Show(Lang.StartError, Lang.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                using (server)
                {
                    Application.Run(new MainContext(server));
                    Config.Save();
                }
            }
        }