From fc07b4cbd31e344f5ed0caa0ee78defed351d5c2 Mon Sep 17 00:00:00 2001 From: thomasbousquet Date: Tue, 21 May 2024 21:43:21 +0200 Subject: [PATCH 1/4] Fix bug in FindNearest that would insert the queried version in the list even if it was already, thus creating the wrong behaviour when pressing ReleaseNotes for versions of the same major release. Make the logic for finding the comparison version for the alpha release notes more verbose. --- UnityLauncherPro/Tools.cs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/UnityLauncherPro/Tools.cs b/UnityLauncherPro/Tools.cs index cf53971..f966954 100644 --- a/UnityLauncherPro/Tools.cs +++ b/UnityLauncherPro/Tools.cs @@ -582,7 +582,7 @@ public static bool VersionIsAlpha(string version) public static bool VersionIsChinese(string version) { - return version.Contains("c1"); + return version.Contains("c1"); } // open release notes page in browser @@ -596,14 +596,19 @@ public static bool OpenReleaseNotes(string version) bool noAlphaReleaseNotesPage = version.Contains("6000") && !version.Contains("f"); if (Properties.Settings.Default.useAlphaReleaseNotes && !noAlphaReleaseNotesPage) { - //with the alpha release notes, we want a diff between the 2 versions, but the site just shows all the changes inclusive of from - // so we need to compare the currently selected version to the one right after it that is available (installed or not) - - var closestVersion = Tools.FindNearestVersion(version, MainWindow.unityInstalledVersions.Keys.ToList(), true); - var getNextVersionToClosest = closestVersion == null ? null : Tools.FindNearestVersion(version, MainWindow.updatesAsStrings); - if (getNextVersionToClosest == null) getNextVersionToClosest = version; + //with the alpha release notes, we want a diff between an installed version and the one selected, but the site just shows all the changes inclusive of "fromVersion=vers" + //so if we find a good installed candidate, we need the version just above it (installed or not) + var comparisonVersion = version; + var closestInstalledVersion = Tools.FindNearestVersion(version, MainWindow.unityInstalledVersions.Keys.ToList(), true); + if (closestInstalledVersion != null) + { + comparisonVersion = closestInstalledVersion; + var nextVersionAfterInstalled = Tools.FindNearestVersion(closestInstalledVersion, MainWindow.updatesAsStrings); + if (nextVersionAfterInstalled != null) comparisonVersion = nextVersionAfterInstalled; + + } - url = "https://alpha.release-notes.ds.unity3d.com/search?fromVersion=" + getNextVersionToClosest + "&toVersion=" + version; + url = "https://alpha.release-notes.ds.unity3d.com/search?fromVersion=" + comparisonVersion + "&toVersion=" + version; } else { @@ -1004,7 +1009,8 @@ public static string FindNearestVersion(string currentVersion, List allA string result = null; // add current version to list, to sort it with others - allAvailable.Add(currentVersion); + if (!allAvailable.Contains(currentVersion)) + allAvailable.Add(currentVersion); // sort list if (checkBelow) From 196595eef2595695e1cfbcc7d2c20858ba2a0637 Mon Sep 17 00:00:00 2001 From: thomasbousquet Date: Tue, 21 May 2024 22:29:51 +0200 Subject: [PATCH 2/4] As of 21 May 2024, Alpha release notes doesn't support non-final version anymore; so change the url logic for that. Update the settings option text in UI --- UnityLauncherPro/MainWindow.xaml | 2 +- UnityLauncherPro/Tools.cs | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/UnityLauncherPro/MainWindow.xaml b/UnityLauncherPro/MainWindow.xaml index 3cf2ac4..a421396 100644 --- a/UnityLauncherPro/MainWindow.xaml +++ b/UnityLauncherPro/MainWindow.xaml @@ -790,7 +790,7 @@ - + + + + + - + @@ -84,10 +88,10 @@ - + + diff --git a/UnityLauncherPro/MainWindow.xaml.cs b/UnityLauncherPro/MainWindow.xaml.cs index 9909639..6ede019 100644 --- a/UnityLauncherPro/MainWindow.xaml.cs +++ b/UnityLauncherPro/MainWindow.xaml.cs @@ -46,7 +46,7 @@ public partial class MainWindow : Window System.Windows.Forms.NotifyIcon notifyIcon; Updates[] updatesSource; - public static List updatesAsStrings; + public static List updatesAsStrings = new List(); string _filterString = null; bool multiWordSearch = false; diff --git a/UnityLauncherPro/Tools.cs b/UnityLauncherPro/Tools.cs index 960c404..86b372b 100644 --- a/UnityLauncherPro/Tools.cs +++ b/UnityLauncherPro/Tools.cs @@ -1014,6 +1014,9 @@ private static string FetchUnityVersionNumberFromHTML(string url) public static string FindNearestVersion(string currentVersion, List allAvailable, bool checkBelow = false) { + if (allAvailable == null) + return null; + string result = null; // add current version to list, to sort it with others From e9bb433560b81e5a917e48503c8921ab5dd16824 Mon Sep 17 00:00:00 2001 From: thomasbousquet Date: Fri, 14 Jun 2024 12:07:24 +0200 Subject: [PATCH 4/4] Add Cumulative Release Notes buttons that gets deactivated if the version selected in't supported by the alpha release notess sites. Split cumulative and non-cumulative OpenReleaseNotes function for better clarity. --- UnityLauncherPro/MainWindow.xaml | 6 +-- UnityLauncherPro/MainWindow.xaml.cs | 19 ++++++++++ UnityLauncherPro/Tools.cs | 58 ++++++++++++++++++----------- 3 files changed, 57 insertions(+), 26 deletions(-) diff --git a/UnityLauncherPro/MainWindow.xaml b/UnityLauncherPro/MainWindow.xaml index c382b16..1855248 100644 --- a/UnityLauncherPro/MainWindow.xaml +++ b/UnityLauncherPro/MainWindow.xaml @@ -512,12 +512,10 @@