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 @@ - - - - + + diff --git a/UnityLauncherPro/MainWindow.xaml.cs b/UnityLauncherPro/MainWindow.xaml.cs index 311331f..14c823b 100644 --- a/UnityLauncherPro/MainWindow.xaml.cs +++ b/UnityLauncherPro/MainWindow.xaml.cs @@ -140,6 +140,7 @@ void Start() // clear updates grid dataGridUpdates.Items.Clear(); + dataGridUpdates.SelectionChanged += DataGridUpdates_SelectionChanged; // clear buildreport grids gridBuildReport.Items.Clear(); @@ -177,6 +178,18 @@ void Start() isInitializing = false; } + private void DataGridUpdates_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + var selectedUp = GetSelectedUpdate(); + bool showCumulative = false; + if (selectedUp != null) + { + var unityVer = GetSelectedUpdate().Version; + showCumulative = Tools.HasAlphaReleaseNotes(unityVer); + } + btnShowCumulatedReleaseNotes.IsEnabled = showCumulative; + } + // bring old window to front, but needs matching appname.. https://stackoverflow.com/a/36804161/5452781 private static void ActivateOtherWindow() { @@ -1542,6 +1555,12 @@ private void BtnOpenWebsite_Click(object sender, RoutedEventArgs e) Tools.OpenReleaseNotes(unity?.Version); } + private void BtnShowCumulatedReleaseNotes_Click(object sender, RoutedEventArgs e) + { + var unity = GetSelectedUpdate(); + Tools.OpenReleaseNotes_Cumulative(unity?.Version); + } + private void ChkMinimizeToTaskbar_CheckedChanged(object sender, RoutedEventArgs e) { if (this.IsActive == false) return; // dont run code on window init diff --git a/UnityLauncherPro/Tools.cs b/UnityLauncherPro/Tools.cs index e0c91a0..08f10bd 100644 --- a/UnityLauncherPro/Tools.cs +++ b/UnityLauncherPro/Tools.cs @@ -588,36 +588,20 @@ public static bool VersionIsChinese(string version) //as of 21 May 2021, only final 'f' versions are now available on the alpha release notes for Unity 2018 and newer. 2017 and 5 still have patch 'p' versions as well. - public static bool HasAlphaReleaseNotes(string version) => version.Contains("f") || version.Contains("p"); + public static bool HasAlphaReleaseNotes(string version) => VersionIsArchived(version) || VersionIsPatch(version); + + public static string GetAlphaReleaseNotesURL(string fromVersion, string toVersion = null) + => "https://alpha.release-notes.ds.unity3d.com/search?fromVersion=" + fromVersion + "&toVersion=" + (toVersion != null ? toVersion : fromVersion); // open release notes page in browser public static bool OpenReleaseNotes(string version) { bool result = false; if (string.IsNullOrEmpty(version)) return false; - string url = null; - if (Properties.Settings.Default.useAlphaReleaseNotes && HasAlphaReleaseNotes(version)) + if(Properties.Settings.Default.useAlphaReleaseNotes && HasAlphaReleaseNotes(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) that has release notes page - var comparisonVersion = version; - var closestInstalledVersion = Tools.FindNearestVersion(version, MainWindow.unityInstalledVersions.Keys.ToList(), true); - if (closestInstalledVersion != null) - { - comparisonVersion = closestInstalledVersion; - string nextFinalVersionAfterInstalled = closestInstalledVersion; - - //wwe need a loop here, to find the nearest final version. It might be better to warn the user about this before opening the page. - do - nextFinalVersionAfterInstalled = Tools.FindNearestVersion(nextFinalVersionAfterInstalled, MainWindow.updatesAsStrings); - while (nextFinalVersionAfterInstalled != null && !HasAlphaReleaseNotes(nextFinalVersionAfterInstalled)); - - if (nextFinalVersionAfterInstalled != null) comparisonVersion = nextFinalVersionAfterInstalled; - - } - - url = "https://alpha.release-notes.ds.unity3d.com/search?fromVersion=" + comparisonVersion + "&toVersion=" + version; + url = GetAlphaReleaseNotesURL(version); } else { @@ -630,6 +614,36 @@ public static bool OpenReleaseNotes(string version) return result; } + public static bool OpenReleaseNotes_Cumulative(string version) + { + bool result = false; + if (string.IsNullOrEmpty(version)) return false; + + string url = null; + var comparisonVersion = 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) that has release notes page + var closestInstalledVersion = Tools.FindNearestVersion(version, MainWindow.unityInstalledVersions.Keys.ToList(), true); + if (closestInstalledVersion != null) + { + comparisonVersion = closestInstalledVersion; + string nextFinalVersionAfterInstalled = closestInstalledVersion; + + //wwe need a loop here, to find the nearest final version. It might be better to warn the user about this before opening the page. + do + nextFinalVersionAfterInstalled = Tools.FindNearestVersion(nextFinalVersionAfterInstalled, MainWindow.updatesAsStrings); + while (nextFinalVersionAfterInstalled != null && !HasAlphaReleaseNotes(nextFinalVersionAfterInstalled)); + + if (nextFinalVersionAfterInstalled != null) comparisonVersion = nextFinalVersionAfterInstalled; + + } + url = GetAlphaReleaseNotesURL(comparisonVersion,version); + + OpenURL(url); + result = true; + return result; + } + public static void OpenURL(string url) { Process.Start(url);