public static bool Supported()
 {
     if (APIChecker.CheckStatus(InformationCache.SelectedServerData.IPAddress + "/Modding/GetModInfo", 10) == APIStatus.NotFound)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        public static void Latest()
        {
            Log.Checking("LAUNCHER UPDATE: Is Version Up to Date or not");
            DiscordLauncherPresence.Status("Start Up", "Checking Latest Launcher Release Information");
            try
            {
                Uri URLCall = new Uri((EnableInsiderBetaTester.Allowed() || EnableInsiderDeveloper.Allowed()) ?
                                      URLs.GitHub_Launcher_Beta : URLs.GitHub_Launcher_Stable);
                ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                var Client = new WebClient
                {
                    Encoding = Encoding.UTF8
                };

                if (!WebCalls.Alternative())
                {
                    Client = new WebClientWithTimeout {
                        Encoding = Encoding.UTF8
                    };
                }
                else
                {
                    Client.Headers.Add("user-agent", "SBRW Launcher " +
                                       Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                }

                try
                {
                    VersionJSON = Client.DownloadString(URLCall);
                    VisualsAPIChecker.GitHubAPI = true;
                }
                catch (WebException Error)
                {
                    APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                           Error, (HttpWebResponse)Error.Response);
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("LAUNCHER UPDATE [GITHUB]", null, Error, null, true);
                }
                finally
                {
                    if (Client != null)
                    {
                        Client.Dispose();
                    }
                }

                if (IsJSONValid.ValidJson(VersionJSON) && VisualsAPIChecker.GitHubAPI)
                {
                    LatestLauncherBuild = (EnableInsiderDeveloper.Allowed() || EnableInsiderBetaTester.Allowed()) ?
                                          JsonConvert.DeserializeObject <List <GitHubRelease> >(VersionJSON)[0].TagName :
                                          JsonConvert.DeserializeObject <GitHubRelease>(VersionJSON).TagName;
                    Log.Info("LAUNCHER UPDATE: GitHub Latest Version -> " + LatestLauncherBuild);
                    ValidJSONDownload = true;
                }
                else
                {
                    Log.Error("LAUNCHER UPDATE: Failed to retrieve Latest Build information from GitHub");
                    ValidJSONDownload = false;
                }
            }
            catch (Exception Error)
            {
                LogToFileAddons.OpenLog("LAUNCHER UPDATE [GITHUB]", null, Error, null, true);
            }

            Log.Completed("LAUNCHER UPDATE: Done");

            if (!UpdateStatusResult())
            {
                Log.Info("FIRST TIME RUN: Moved to Function");
                /* Do First Time Run Checks */
                FunctionStatus.FirstTimeRun();
            }
            else
            {
                if (DiscordLauncherPresence.Running())
                {
                    DiscordLauncherPresence.Stop("Close");
                }

                if (ServerProxy.Running())
                {
                    ServerProxy.Instance.Stop("Force Close");
                }

                Application.Exit();
            }
        }
Exemple #3
0
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            Refresh();

            List <string> registerErrors = new List <string>();

            if (string.IsNullOrWhiteSpace(RegisterEmail.Text))
            {
                registerErrors.Add("Please enter your e-mail.");
                RegisterEmailBorder.Image = Theming.BorderEmailError;
            }
            else if (!IsEmailValid.Validate(RegisterEmail.Text))
            {
                registerErrors.Add("Please enter a valid e-mail address.");
                RegisterEmailBorder.Image = Theming.BorderEmailError;
            }

            if (string.IsNullOrWhiteSpace(RegisterTicket.Text) && _ticketRequired)
            {
                registerErrors.Add("Please enter your ticket.");
                RegisterTicketBorder.Image = Theming.BorderTicketError;
            }

            if (string.IsNullOrWhiteSpace(RegisterPassword.Text))
            {
                registerErrors.Add("Please enter your password.");
                RegisterPasswordBorder.Image = Theming.BorderPasswordError;
            }

            if (string.IsNullOrWhiteSpace(RegisterConfirmPassword.Text))
            {
                registerErrors.Add("Please confirm your password.");
                RegisterConfirmPasswordBorder.Image = Theming.BorderPasswordError;
            }

            if (RegisterConfirmPassword.Text != RegisterPassword.Text)
            {
                registerErrors.Add("Passwords don't match.");
                RegisterConfirmPasswordBorder.Image = Theming.BorderPasswordError;
            }

            if (!RegisterAgree.Checked)
            {
                registerErrors.Add("You have not agreed to the Terms of Service.");
                RegisterAgree.ForeColor = Theming.Error;
            }

            if (registerErrors.Count == 0)
            {
                bool allowReg = false;

                String Email;
                String Password;

                switch (Authentication.HashType(InformationCache.SelectedServerJSON.authHash ?? string.Empty))
                {
                case AuthHash.H10:
                    Email    = RegisterEmail.Text.ToString();
                    Password = RegisterPassword.Text.ToString();
                    break;

                case AuthHash.H11:
                    Email    = RegisterEmail.Text.ToString();
                    Password = MDFive.Hashes(RegisterPassword.Text.ToString()).ToLower();
                    break;

                case AuthHash.H12:
                    Email    = RegisterEmail.Text.ToString();
                    Password = SHA.Hashes(RegisterPassword.Text.ToString()).ToLower();
                    break;

                case AuthHash.H13:
                    Email    = RegisterEmail.Text.ToString();
                    Password = SHATwoFiveSix.Hashes(RegisterPassword.Text.ToString()).ToLower();
                    break;

                case AuthHash.H20:
                    Email    = MDFive.Hashes(RegisterEmail.Text.ToString()).ToLower();
                    Password = MDFive.Hashes(RegisterPassword.Text.ToString()).ToLower();
                    break;

                case AuthHash.H21:
                    Email    = SHA.Hashes(RegisterEmail.Text.ToString()).ToLower();
                    Password = SHA.Hashes(RegisterPassword.Text.ToString()).ToLower();
                    break;

                case AuthHash.H22:
                    Email    = SHATwoFiveSix.Hashes(RegisterEmail.Text.ToString()).ToLower();
                    Password = SHATwoFiveSix.Hashes(RegisterPassword.Text.ToString()).ToLower();
                    break;

                default:
                    Log.Error("HASH TYPE: Unknown Hash Standard was Provided");
                    return;
                }

                try
                {
                    string[] regex = new Regex(@"([0-9A-Z]{5})([0-9A-Z]{35})").Split(Password.ToUpper());

                    Uri URLCall = new Uri("https://api.pwnedpasswords.com/range/" + regex[1]);
                    ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                    var Client = new WebClient
                    {
                        Encoding = Encoding.UTF8
                    };
                    if (!WebCalls.Alternative())
                    {
                        Client = new WebClientWithTimeout {
                            Encoding = Encoding.UTF8
                        };
                    }
                    else
                    {
                        Client.Headers.Add("user-agent", "SBRW Launcher " +
                                           Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                    }

                    String serverReply = null;
                    try
                    {
                        serverReply = Client.DownloadString(URLCall);
                    }
                    catch (WebException Error)
                    {
                        APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                               Error, (HttpWebResponse)Error.Response);
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("Register", null, Error, null, true);
                    }
                    finally
                    {
                        if (Client != null)
                        {
                            Client.Dispose();
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(serverReply))
                    {
                        String verify = regex[2];

                        string[] hashes = serverReply.Split('\n');
                        foreach (string hash in hashes)
                        {
                            var splitChecks = hash.Split(':');
                            if (splitChecks[0] == verify)
                            {
                                var passwordCheckReply = MessageBox.Show(null, "Password used for registration has been breached " + Convert.ToInt32(splitChecks[1]) +
                                                                         " times, you should consider using a different one.\n\nAlternatively you can use the unsafe password anyway." +
                                                                         "\nWould you like to continue to use it?", "GameLauncher", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                                if (passwordCheckReply == DialogResult.Yes)
                                {
                                    allowReg = true;
                                }
                                else
                                {
                                    allowReg = false;
                                }
                            }
                            else
                            {
                                allowReg = true;
                            }
                        }
                    }
                    else
                    {
                        allowReg = true;
                    }
                }
                catch
                {
                    allowReg = true;
                }

                if (allowReg)
                {
                    Tokens.Clear();

                    Tokens.IPAddress  = InformationCache.SelectedServerData.IPAddress;
                    Tokens.ServerName = ServerListUpdater.ServerName("Register");

                    Authentication.Client("Register", InformationCache.SelectedServerJSON.modernAuthSupport, Email, Password, _ticketRequired ? RegisterTicket.Text : null);

                    if (!String.IsNullOrWhiteSpace(Tokens.Success))
                    {
                        DialogResult Success = MessageBox.Show(null, Tokens.Success, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        if (Success == DialogResult.OK)
                        {
                            Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show(null, Tokens.Error, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    var message = "There were some errors while registering. Please fix them:\n\n";

                    foreach (var error in registerErrors)
                    {
                        message += "• " + error + "\n";
                    }

                    MessageBox.Show(null, message, "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /* Retrieve CA Information */
        /// <summary>
        /// Retrieves the Root CA JSON file with the latest details of the Certificate
        /// </summary>
        /// <remarks>Sets the Certificate Details For Launcher Comparison</remarks>
        public static void Latest()
        {
            if (!UnixOS.Detected())
            {
                Log.Checking("CERTIFICATE STORE: Is Installed or Not");
                DiscordLauncherPresence.Status("Start Up", "Checking Root Certificate Authority");

                try
                {
                    Uri URLCall = new Uri("http://crl.carboncrew.org/RCA-Info.json");
                    ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                    var Client = new WebClient
                    {
                        Encoding = Encoding.UTF8
                    };
                    if (!WebCalls.Alternative())
                    {
                        Client = new WebClientWithTimeout {
                            Encoding = Encoding.UTF8
                        };
                    }
                    else
                    {
                        Client.Headers.Add("user-agent", "SBRW Launcher " +
                                           Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                    }

                    try
                    {
                        /* Download Up to Date Certificate Status */
                        RootCAJson = Client.DownloadString(URLCall);
                    }
                    catch (WebException Error)
                    {
                        APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                               Error, (HttpWebResponse)Error.Response);
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("CERTIFICATE STORE", null, Error, null, true);
                    }
                    finally
                    {
                        if (Client != null)
                        {
                            Client.Dispose();
                        }
                    }

                    if (IsJSONValid.ValidJson(RootCAJson))
                    {
                        JsonRootCA API = JsonConvert.DeserializeObject <JsonRootCA>(RootCAJson);

                        if (API.CN != null)
                        {
                            Log.Info("CERTIFICATE STORE: Setting Common Name -> " + API.CN);
                            RootCACommonName = API.CN;
                        }

                        if (API.Subject != null)
                        {
                            Log.Info("CERTIFICATE STORE: Setting Subject Name -> " + API.Subject);
                            RootCASubjectName = API.Subject;
                        }

                        if (API.Ids != null)
                        {
                            foreach (IdsModel entries in API.Ids)
                            {
                                if (entries.Serial != null)
                                {
                                    Log.Info("CERTIFICATE STORE: Setting Serial Number -> " + entries.Serial);
                                    RootCASerial = entries.Serial;
                                }
                            }
                        }

                        if (API.File != null)
                        {
                            foreach (FileModel entries in API.File)
                            {
                                if (entries.Name != null)
                                {
                                    Log.Info("CERTIFICATE STORE: Setting Root CA File Name -> " + entries.Name);
                                    RootCAFileName = entries.Name;
                                }

                                if (entries.Cer != null)
                                {
                                    Log.Info("CERTIFICATE STORE: Setting Root CA File URL -> " + entries.Cer);
                                    RootCAFileURL = entries.Cer;
                                }
                            }
                        }

                        if (API != null)
                        {
                            API = null;
                        }
                    }
                    else
                    {
                        Log.Warning("CERTIFICATE STORE: Received Invalid JSON Data");
                    }
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("CERTIFICATE STORE", null, Error, null, true);
                }
                finally
                {
                    if (RootCAJson != null)
                    {
                        RootCAJson = null;
                    }
                }

                /* Install Custom Root Certificate (If Default Values aren't used) */
                if (RootCASerial != "7449A8EB07C997A6")
                {
                    try
                    {
                        X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
                        store.Open(OpenFlags.ReadWrite);

                        var certificatesThumbPrint = store.Certificates.Find(X509FindType.FindByThumbprint,
                                                                             RootCASerial, false);

                        for (int i = 0; i < store.Certificates.Count; i++)
                        {
                            if (store.Certificates[i].SerialNumber == RootCASerial)
                            {
                                Log.Info("CERTIFICATE STORE: Found Root CA [" + store.Certificates[i].Subject + "]");
                                Log.Info("CERTIFICATE STORE: Serial Number [" + store.Certificates[i].SerialNumber + "]");
                                IsROOTCAInstalled = true;
                            }
                            else if (store.Certificates[i].SerialNumber != RootCASerial && store.Certificates[i].Subject == RootCASubjectName)
                            {
                                Log.Info("CERTIFICATE STORE: Removing OLD Root CA [" + store.Certificates[i].Subject + "]");
                                Log.Info("CERTIFICATE STORE: Serial Number [" + store.Certificates[i].SerialNumber + "]");
                                store.Remove(store.Certificates[i]);
                            }
                        }
                        store.Close();
                        store.Dispose();
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("CERTIFICATE STORE", null, Error, null, true);
                    }

                    string CertSaveLocation = Strings.Encode(Path.Combine(Locations.LauncherFolder, RootCAFileName + ".cer"));

                    try
                    {
                        if (!IsROOTCAInstalled)
                        {
                            Uri URLCall = new Uri(RootCAFileURL);
                            ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                            var Client = new WebClient
                            {
                                Encoding = Encoding.UTF8
                            };
                            if (!WebCalls.Alternative())
                            {
                                Client = new WebClientWithTimeout {
                                    Encoding = Encoding.UTF8
                                };
                            }
                            else
                            {
                                Client.Headers.Add("user-agent", "SBRW Launcher " +
                                                   Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                            }

                            try
                            {
                                /* Download Up to Date Certificate Status */
                                Client.DownloadFile(URLCall, CertSaveLocation);
                            }
                            catch (WebException Error)
                            {
                                APIChecker.StatusCodes(RootCAFileURL, Error, (HttpWebResponse)Error.Response);
                            }
                            catch (Exception Error)
                            {
                                LogToFileAddons.OpenLog("CERTIFICATE STORE", null, Error, null, true);
                            }
                            finally
                            {
                                if (Client != null)
                                {
                                    Client.Dispose();
                                }
                            }

                            if (File.Exists(CertSaveLocation))
                            {
                                X509Store Store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
                                Store.Open(OpenFlags.ReadWrite);
                                X509Certificate2Collection collection = new X509Certificate2Collection();
                                X509Certificate2           cert       = new X509Certificate2(CertSaveLocation);
                                byte[] encodedCert = cert.GetRawCertData();
                                Log.Info("CERTIFICATE STORE: We are now installing [" + RootCACommonName + "] certificate into the Trusted Root Certificate store ...");
                                Store.Add(cert);
                                Log.Info("CERTIFICATE STORE: Done! [" + RootCACommonName + "] certificate was installed successfully.");
                                Store.Close();
                                Store.Dispose();
                            }
                        }
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("CERTIFICATE STORE", null, Error, null, true);
                    }

                    try
                    {
                        if (File.Exists(CertSaveLocation))
                        {
                            Log.Info("CERTIFICATE STORE: Removed [" + RootCACommonName + "] certificate from launcher folder.");
                            File.Delete(CertSaveLocation);
                        }
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("CERTIFICATE STORE", null, Error, null, true);
                    }
                }
                else
                {
                    Log.Warning("CERTIFICATE STORE: Default Information was detected. Not running additional Function Calls");
                }

                Log.Completed("CERTIFICATE STORE: Done");
            }

            Log.Checking("CERTIFICATE CHECK: Is Signed or Not");
            try
            {
                X509Certificate certificate = null;

                try
                {
                    Assembly assembly = Assembly.LoadFrom(Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameLauncher)));
                    Module   module   = assembly.GetModules().First();
                    certificate = module.GetSignerCertificate();

                    if (certificate != null)
                    {
                        LauncherSerial = certificate.GetSerialNumberString();
                    }
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("CERTIFICATE CHECK", null, Error, null, true);
                }
                finally
                {
                    if (certificate != null)
                    {
                        certificate.Dispose();
                    }
                }
            }
            catch (Exception Error)
            {
                LogToFileAddons.OpenLog("CERTIFICATE CHECK", null, Error, null, true);
            }
            Log.Completed("CERTIFICATE CHECK: Done");

            Log.Info("VERIFIED: Moved to Function");
            /* (Start Process) Check if Launcher Is Signed or Not */
            IsExeVerified.Check();
        }
Exemple #5
0
        public static void Check()
        {
            if (!UnixOS.Detected())
            {
                Log.Checking("REDISTRIBUTABLE: Is Installed or Not");
                DiscordLauncherPresence.Status("Start Up", "Checking Redistributable Package Visual Code 2015 to 2019");

                if (!RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x86))
                {
                    if (MessageBox.Show(Translations.Database("Redistributable_VC_32") +
                                        "\n\n" + Translations.Database("Redistributable_VC_P2") +
                                        "\n\n" + Translations.Database("Redistributable_VC_P3") +
                                        "\n\n" + Translations.Database("Redistributable_VC_P4"),
                                        Translations.Database("Redistributable_VC_P5"),
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        try
                        {
                            Uri URLCall = new Uri("https://aka.ms/vs/16/release/VC_redist.x86.exe");
                            ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                            var Client = new WebClient();

                            if (!WebCalls.Alternative())
                            {
                                Client = new WebClientWithTimeout();
                            }
                            else
                            {
                                Client.Headers.Add("user-agent", "SBRW Launcher " +
                                                   Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                            }

                            try
                            {
                                Client.DownloadFile(URLCall, "VC_redist.x86.exe");
                            }
                            catch (WebException Error)
                            {
                                APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                                       Error, (HttpWebResponse)Error.Response);
                            }
                            catch (Exception Error)
                            {
                                LogToFileAddons.OpenLog("REDISTRIBUTABLE", null, Error, null, true);
                            }
                            finally
                            {
                                if (Client != null)
                                {
                                    Client.Dispose();
                                }
                            }
                        }
                        catch (Exception Error)
                        {
                            LogToFileAddons.OpenLog("REDISTRIBUTABLE", null, Error, null, true);
                        }

                        if (File.Exists("VC_redist.x86.exe"))
                        {
                            try
                            {
                                var proc = Process.Start(new ProcessStartInfo
                                {
                                    Verb      = "runas",
                                    Arguments = "/quiet",
                                    FileName  = "VC_redist.x86.exe"
                                });
                                proc.WaitForExit((int)TimeSpan.FromMinutes(10).TotalMilliseconds);

                                if (proc == null)
                                {
                                    ErrorFree = false;
                                    MessageBox.Show(Translations.Database("Redistributable_VC_P6"),
                                                    Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);
                                }
                                else if (proc != null)
                                {
                                    if (!proc.HasExited)
                                    {
                                        if (proc.Responding)
                                        {
                                            proc.CloseMainWindow();
                                        }
                                        else
                                        {
                                            proc.Kill(); ErrorFree = false;
                                        }
                                    }

                                    if (proc.ExitCode != 0)
                                    {
                                        ErrorFree = false;
                                        Log.Error("REDISTRIBUTABLE INSTALLER [EXIT CODE]: " + proc.ExitCode.ToString() +
                                                  " HEX: (0x" + proc.ExitCode.ToString("X") + ")");
                                        MessageBox.Show(Translations.Database("Redistributable_VC_P7") + " " + proc.ExitCode.ToString() +
                                                        " (0x" + proc.ExitCode.ToString("X") + ")" +
                                                        "\n" + Translations.Database("Redistributable_VC_P8"),
                                                        Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);
                                    }

                                    proc.Close();
                                }
                            }
                            catch (Exception Error)
                            {
                                LogToFileAddons.OpenLog("REDISTRIBUTABLE x86 Process", null, Error, null, true);
                                ErrorFree = false;
                                MessageBox.Show(Translations.Database("Redistributable_VC_P9"),
                                                Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            ErrorFree = false;
                            MessageBox.Show(Translations.Database("Redistributable_VC_P10"),
                                            Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        ErrorFree = false;
                        MessageBox.Show(Translations.Database("Redistributable_VC_P8"), Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Log.Info("REDISTRIBUTABLE: 32-bit 2015-2019 VC++ Redistributable Package is Installed");
                }

                if (Environment.Is64BitOperatingSystem)
                {
                    if (!RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x64))
                    {
                        if (MessageBox.Show(Translations.Database("Redistributable_VC_64") +
                                            "\n\n" + Translations.Database("Redistributable_VC_P2") +
                                            "\n\n" + Translations.Database("Redistributable_VC_P3") +
                                            "\n\n" + Translations.Database("Redistributable_VC_P4"),
                                            Translations.Database("Redistributable_VC_P5"),
                                            MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                        {
                            try
                            {
                                Uri URLCall = new Uri("https://aka.ms/vs/16/release/VC_redist.x64.exe");
                                ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                                var Client = new WebClient();

                                if (!WebCalls.Alternative())
                                {
                                    Client = new WebClientWithTimeout();
                                }
                                else
                                {
                                    Client.Headers.Add("user-agent", "SBRW Launcher " +
                                                       Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                                }

                                try
                                {
                                    Client.DownloadFile(URLCall, "VC_redist.x64.exe");
                                }
                                catch (WebException Error)
                                {
                                    APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                                           Error, (HttpWebResponse)Error.Response);
                                }
                                catch (Exception Error)
                                {
                                    LogToFileAddons.OpenLog("REDISTRIBUTABLE", null, Error, null, true);
                                }
                                finally
                                {
                                    if (Client != null)
                                    {
                                        Client.Dispose();
                                    }
                                }
                            }
                            catch (Exception Error)
                            {
                                LogToFileAddons.OpenLog("REDISTRIBUTABLE x64", null, Error, null, true);
                            }

                            if (File.Exists("VC_redist.x64.exe"))
                            {
                                try
                                {
                                    var proc = Process.Start(new ProcessStartInfo
                                    {
                                        Verb      = "runas",
                                        Arguments = "/quiet",
                                        FileName  = "VC_redist.x64.exe"
                                    });

                                    proc.WaitForExit((int)TimeSpan.FromMinutes(10).TotalMilliseconds);

                                    if (proc == null)
                                    {
                                        ErrorFree = false;
                                        MessageBox.Show(Translations.Database("Redistributable_VC_P6"),
                                                        Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);
                                    }
                                    else if (proc != null)
                                    {
                                        if (!proc.HasExited)
                                        {
                                            if (proc.Responding)
                                            {
                                                proc.CloseMainWindow();
                                            }
                                            else
                                            {
                                                proc.Kill(); ErrorFree = false;
                                            }
                                        }

                                        if (proc.ExitCode != 0)
                                        {
                                            ErrorFree = false;
                                            Log.Error("REDISTRIBUTABLE INSTALLER [EXIT CODE]: " + proc.ExitCode.ToString() +
                                                      " HEX: (0x" + proc.ExitCode.ToString("X") + ")");
                                            MessageBox.Show(Translations.Database("Redistributable_VC_P7") + " " + proc.ExitCode.ToString() +
                                                            " (0x" + proc.ExitCode.ToString("X") + ")" +
                                                            "\n" + Translations.Database("Redistributable_VC_P8"),
                                                            Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                            MessageBoxIcon.Error);
                                        }

                                        proc.Close();
                                    }
                                }
                                catch (Exception Error)
                                {
                                    LogToFileAddons.OpenLog("REDISTRIBUTABLE x64 Process", null, Error, null, true);
                                    ErrorFree = false;
                                    MessageBox.Show(Translations.Database("Redistributable_VC_P9"),
                                                    Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                ErrorFree = false;
                                MessageBox.Show(Translations.Database("Redistributable_VC_P10"),
                                                Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                                MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            ErrorFree = false;
                            MessageBox.Show(Translations.Database("Redistributable_VC_P8"),
                                            Translations.Database("Redistributable_VC_P5"), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        Log.Info("REDISTRIBUTABLE: 64-bit 2015-2019 VC++ Redistributable Package is Installed");
                    }
                }

                Log.Completed("REDISTRIBUTABLE: Done");
            }

            Log.Info("ID: Moved to Function");
            /* (Start Process) */
            HardwareID.FingerPrint.Get();
        }
        /* Check If Updater Exists or Requires an Update */
        public static void Check()
        {
            Log.Checking("LAUNCHER UPDATER: Is Version Up to Date or not");
            DiscordLauncherPresence.Status("Start Up", "Checking Launcher and Updater Release Information");

            /* Update this text file if a new GameLauncherUpdater.exe has been delployed - DavidCarbon */
            try
            {
                bool IsGithubOnline = false;
                Uri  URLCall        = new Uri(URLs.GitHub_Updater);
                ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                var Client = new WebClient
                {
                    Encoding = Encoding.UTF8
                };
                if (!WebCalls.Alternative())
                {
                    Client = new WebClientWithTimeout {
                        Encoding = Encoding.UTF8
                    };
                }
                else
                {
                    Client.Headers.Add("user-agent", "SBRW Launcher " +
                                       Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                }

                try
                {
                    VersionJSON    = Client.DownloadString(URLCall);
                    IsGithubOnline = true;
                }
                catch (WebException Error)
                {
                    APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                           Error, (HttpWebResponse)Error.Response);
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("LAUNCHER UPDATER", null, Error, null, true);
                }
                finally
                {
                    if (Client != null)
                    {
                        Client.Dispose();
                    }
                }

                bool IsJsonValid = false;

                try
                {
                    if (IsJSONValid.ValidJson(VersionJSON) && IsGithubOnline)
                    {
                        GitHubRelease GHAPI = JsonConvert.DeserializeObject <GitHubRelease>(VersionJSON);

                        if (GHAPI.TagName != null)
                        {
                            Log.Info("LAUNCHER UPDATER: Setting Latest Version -> " + GHAPI.TagName);
                            LatestUpdaterBuildVersion = GHAPI.TagName;
                            IsJsonValid = true;
                        }

                        Log.Info("LAUNCHER UPDATER: Latest Version -> " + LatestUpdaterBuildVersion);

                        if (GHAPI != null)
                        {
                            GHAPI = null;
                        }
                    }
                    else
                    {
                        Log.Warning("LAUNCHER UPDATER: Received Invalid JSON Data");
                    }
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("LAUNCHER UPDATER", null, Error, null, true);
                }

                if (!IsGithubOnline || !IsJsonValid)
                {
                    Log.Info("LAUNCHER UPDATER: Fail Safe Latest Version -> " + LatestUpdaterBuildVersion);
                }
            }
            catch (Exception Error)
            {
                LogToFileAddons.OpenLog("LAUNCHER UPDATER", null, Error, null, true);
            }
            finally
            {
                if (VersionJSON != null)
                {
                    VersionJSON = null;
                }
            }

            /* Check if File needs to be Downloaded or Require an Update */
            string UpdaterPath = Strings.Encode(Path.Combine(Locations.LauncherFolder, Locations.NameUpdater));

            if (!File.Exists(UpdaterPath))
            {
                Log.Info("LAUNCHER UPDATER: Starting GameLauncherUpdater downloader");
                try
                {
                    Uri URLCall =
                        new Uri("https://github.com/SoapboxRaceWorld/GameLauncherUpdater/releases/latest/download/GameLauncherUpdater.exe");
                    ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                    var Client = new WebClient
                    {
                        Encoding = Encoding.UTF8
                    };
                    if (!WebCalls.Alternative())
                    {
                        Client = new WebClientWithTimeout {
                            Encoding = Encoding.UTF8
                        };
                    }
                    else
                    {
                        Client.Headers.Add("user-agent", "SBRW Launcher " +
                                           Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                    }
                    Client.DownloadFileCompleted += (object sender, AsyncCompletedEventArgs e) =>
                    {
                        if (File.Exists(UpdaterPath))
                        {
                            try
                            {
                                if (new FileInfo(UpdaterPath).Length == 0)
                                {
                                    File.Delete(UpdaterPath);
                                }
                            }
                            catch (Exception Error)
                            {
                                LogToFileAddons.OpenLog("LAUNCHER UPDATER [EXE Error #1]", null, Error, null, true);
                            }
                        }
                    };

                    try
                    {
                        Client.DownloadFile(URLCall, UpdaterPath);
                    }
                    catch (WebException Error)
                    {
                        APIChecker.StatusCodes(URLCall.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped),
                                               Error, (HttpWebResponse)Error.Response);
                    }
                    catch (Exception Error)
                    {
                        LogToFileAddons.OpenLog("LAUNCHER UPDATER [EXE DL #1]", null, Error, null, true);
                    }
                    finally
                    {
                        if (Client != null)
                        {
                            Client.Dispose();
                        }
                    }
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("LAUNCHER UPDATER [!FileExists]", null, Error, null, true);
                }
            }
            else if (File.Exists(UpdaterPath))
            {
                try
                {
                    var LauncherUpdaterBuild       = FileVersionInfo.GetVersionInfo(UpdaterPath);
                    var LauncherUpdaterBuildNumber = LauncherUpdaterBuild.FileVersion;
                    var UpdaterBuildNumberResult   = LauncherUpdaterBuildNumber.CompareTo(LatestUpdaterBuildVersion);

                    Log.Build("LAUNCHER UPDATER BUILD: GameLauncherUpdater " + LauncherUpdaterBuildNumber);
                    if (UpdaterBuildNumberResult < 0)
                    {
                        Log.Info("LAUNCHER UPDATER: " + UpdaterBuildNumberResult + " Builds behind latest Updater!");
                    }
                    else
                    {
                        Log.Info("LAUNCHER UPDATER: Latest GameLauncherUpdater!");
                    }

                    if (UpdaterBuildNumberResult < 0)
                    {
                        Log.Info("LAUNCHER UPDATER: Downloading New " + Locations.NameUpdater);
                        File.Delete(Locations.NameUpdater);

                        Uri URLCall =
                            new Uri("https://github.com/SoapboxRaceWorld/GameLauncherUpdater/releases/latest/download/GameLauncherUpdater.exe");
                        ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromMinutes(1).TotalMilliseconds;
                        var Client = new WebClient
                        {
                            Encoding = Encoding.UTF8
                        };
                        if (!WebCalls.Alternative())
                        {
                            Client = new WebClientWithTimeout {
                                Encoding = Encoding.UTF8
                            };
                        }
                        else
                        {
                            Client.Headers.Add("user-agent", "SBRW Launcher " +
                                               Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)");
                        }
                        Client.DownloadFileCompleted += (object sender, AsyncCompletedEventArgs e) =>
                        {
                            if (File.Exists(UpdaterPath))
                            {
                                try
                                {
                                    if (new FileInfo(UpdaterPath).Length == 0)
                                    {
                                        File.Delete(UpdaterPath);
                                    }
                                }
                                catch (Exception Error)
                                {
                                    LogToFileAddons.OpenLog("LAUNCHER UPDATER [EXE Error #2]", null, Error, null, true);
                                }
                            }
                        };

                        try
                        {
                            Client.DownloadFile(URLCall, Locations.NameUpdater);
                        }
                        catch (WebException Error)
                        {
                            APIChecker.StatusCodes(
                                "https://github.com/SoapboxRaceWorld/GameLauncherUpdater/releases/latest/download/GameLauncherUpdater.exe",
                                Error, (HttpWebResponse)Error.Response);
                        }
                        catch (Exception Error)
                        {
                            LogToFileAddons.OpenLog("LAUNCHER UPDATER [EXE DL #2]", null, Error, null, true);
                        }
                        finally
                        {
                            if (Client != null)
                            {
                                Client.Dispose();
                            }
                        }
                    }
                }
                catch (Exception Error)
                {
                    LogToFileAddons.OpenLog("LAUNCHER UPDATER [FileExists]", null, Error, null, true);
                }
            }

            Log.Completed("LAUNCHER UPDATER: Done");

            Log.Info("LAUNCHER UPDATE: Moved to Function");
            /* (Start Process) Check Latest Launcher Version */
            LauncherUpdateCheck.Latest();
        }