예제 #1
0
        /// <summary>
        /// Checks for launcher and file updates
        /// </summary>
        private void CheckForUpdates()
        {
            //Check to see if we are bypassing
            if (BypassDownload)
            { //We are, bypass downloading
                UpdateComplete();
                return;
            }

            UpdateStatusMsg("Checking for launcher updates...");
            AssetDownloadController.CurrentDirectory = currentDirectory;
            AssetDownloadController.SetForm(this);
            try
            {
                string version    = GameSettings.Launcher._version;
                string versionUrl = new System.Net.WebClient().DownloadString(GameSettings.Launcher._versionURL);
                if (!string.IsNullOrWhiteSpace(versionUrl.Trim()) && !version.Equals(versionUrl.Trim(), StringComparison.Ordinal))
                { //Strings dont match, check for greater than by parsing into int
                    if (VersionCheck(version, versionUrl))
                    {
                        UpdateStatusMsg("No launcher files to update. Skipping...");
                    }
                    else
                    {
                        AssetDownloadController.OnUpdateLauncher += UpdateLauncher;
                        AssetDownloadController.DownloadAssets(GameSettings.Launcher._launcherAssets, GameSettings.Launcher._launcherAssetList);
                        return;
                    }
                }
                else
                {
                    UpdateStatusMsg("No launcher files to update. Skipping...");
                }
            }
            catch
            { UpdateStatusMsg("Cannot download launcher updates....Skipping."); }

            UpdateFiles();
        }