Пример #1
0
        internal static void Check()
        {
            if (PlayerPrefs.GetInt("QModManager_EnableUpdateCheck", 1) == 0)
            {
                Logger.Info("Update check disabled");
                return;
            }

            if (!NetworkUtilities.CheckConnection())
            {
                Logger.Warn("Cannot check for updates, internet disabled");
                return;
            }

            ServicePointManager.ServerCertificateValidationCallback = NetworkUtilities.CustomSCVC;

            using (WebClient client = new WebClient())
            {
                client.DownloadStringCompleted += (sender, e) =>
                {
                    if (e.Error != null)
                    {
                        Logger.Error("There was an error retrieving the latest version from GitHub!");
                        Logger.Exception(e.Error);
                        return;
                    }
                    Parse(e.Result);
                };

                Logger.Debug("Getting the latest version...");
                client.DownloadStringAsync(new Uri(VersionURL));
            }
        }