public void SetLauncherReady()
        {
            updateLabelText.Text = "";
            if (!File.Exists(Constants.GAME_EXECUTABLE_PATH))
            {
                MessageBox.Show("Couldn't make a connection to the game server. Please try again later or inform the developer if the issue persists.", "Fatal error");
                return;
            }

            currentVersionLabel.Text = OnlineVersion.ToString();
            Properties.Settings.Default.VersionText = OnlineVersion.ToString();
            Properties.Settings.Default.Save();
            Console.WriteLine("Updated version. Now running on version: " + LocalVersion);
            IsReady = true;

            if (Constants.AUTOMATICALLY_LAUNCH_GAME_AFTER_UPDATING)
            {
                LaunchGame();
            }

            try {
                File.Delete(Constants.ZIP_PATH);
            } catch {
                MessageBox.Show("Couldn't delete the downloaded zip file after extraction.");
            }
        }
示例#2
0
        private static void CheckSite(string site, bool manual)
        {
            using (System.Net.WebClient wc = new System.Net.WebClient())
            {
                wc.Headers.Add("User-Agent: .Net WebClient");
                string json = wc.DownloadString(site);

                List <OnlineVersion> versions = Tools.JSONParser.FromJson <List <OnlineVersion> >(json);

                bool build = Settings.GetObject("Auto Update Build", false) || manual;
                bool pre   = Settings.GetObject("Auto Update Pre", false);

                Version       current = typeof(GitHub).Assembly.GetName().Version;
                OnlineVersion found   = null;
                foreach (OnlineVersion ov in versions)   //version start with higher first
                {
                    if (!ov.IsValid)                     //skip invalid
                    {
                        continue;
                    }
                    if (!pre && ov.IsPreRelease)                     //skip pre-release
                    {
                        continue;
                    }
                    if (!build && ov.Version.Build != 0)                     //skip build version (only update to minor number change)
                    {
                        continue;
                    }
                    if (found != null && ov.Version < found.Version)                     //already found a better match
                    {
                        continue;
                    }

                    if (ov.Version > current)
                    {
                        found = ov;
                    }
                }

                if (found != null)
                {
                    NewVersion?.Invoke(current, found, null);
                }
                else if (manual)                 //notify "no new version"
                {
                    NewVersion?.Invoke(current, null, null);
                }
            }
        }
示例#3
0
 private void CheckForUpdate(string currentVersion)
 {
     try
     {
         var latestUpdate = UpdateChecker.CheckForUpdates("http://jdevillard.blob.core.windows.net/codeplex/amslogviewer/release.xml", UpdateFilter.Beta);
         if (latestUpdate != null)
         {
             _onlineVersion = latestUpdate;
             var latestVersion = latestUpdate.newversion.Replace(".", String.Empty);
             if (Int32.Parse(latestVersion) > Int32.Parse(currentVersion))
             {
                 IsNewVersionAvailable        = true;
                 AvailableVersion             = latestUpdate.newversion;
                 _aboutView.btnUpdate.Content = "Update";
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
 public override string GetDisplayName()
 {
     return("LAV Filters" + (OnlineVersion != null ? " " + OnlineVersion.ToString() : ""));
 }