Skip to content

Alpha Release Notes: Add support for 6000.0f version and fix bugs in comparison. #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion UnityLauncherPro/GetUnityUpdates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ public static async Task<string> Scan()
return result;
}

public static Updates[] Parse(string items)
public static Updates[] Parse(string items, ref List<string> updatesAsString)
{
if (updatesAsString == null)
updatesAsString = new List<string>();
updatesAsString.Clear();

isDownloadingUnityList = false;
//SetStatus("Downloading list of Unity versions ... done");
var receivedList = items.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
Expand All @@ -68,6 +72,7 @@ public static Updates[] Parse(string items)
u.ReleaseDate = DateTime.ParseExact(row[3], "MM/dd/yyyy", CultureInfo.InvariantCulture);
u.Version = versionTemp;
releases.Add(versionTemp, u);
updatesAsString.Add(versionTemp);
}

prevVersion = versionTemp;
Expand Down
5 changes: 3 additions & 2 deletions UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public partial class MainWindow : Window
System.Windows.Forms.NotifyIcon notifyIcon;

Updates[] updatesSource;
public static List<string> updatesAsStrings;

string _filterString = null;
bool multiWordSearch = false;
Expand Down Expand Up @@ -744,7 +745,7 @@ async Task CallGetUnityUpdates()
var items = await task;
//Console.WriteLine("CallGetUnityUpdates=" + items == null);
if (items == null) return;
updatesSource = GetUnityUpdates.Parse(items);
updatesSource = GetUnityUpdates.Parse(items, ref updatesAsStrings);
if (updatesSource == null) return;
dataGridUpdates.ItemsSource = updatesSource;
}
Expand Down Expand Up @@ -1034,7 +1035,7 @@ private async void OnTabSelectionChanged(object sender, SelectionChangedEventArg
var items = await task;
if (task.IsCompleted == false || task.IsFaulted == true) return;
if (items == null) return;
updatesSource = GetUnityUpdates.Parse(items);
updatesSource = GetUnityUpdates.Parse(items, ref updatesAsStrings);
if (updatesSource == null) return;
dataGridUpdates.ItemsSource = updatesSource;
}
Expand Down
11 changes: 8 additions & 3 deletions UnityLauncherPro/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,17 @@ public static bool OpenReleaseNotes(string version)

//var url = Tools.GetUnityReleaseURL(version);
string url = null;
if (Properties.Settings.Default.useAlphaReleaseNotes && !version.Contains("6000"))
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);
if (closestVersion == null) closestVersion = version;
var getNextVersionToClosest = closestVersion == null ? null : Tools.FindNearestVersion(version, MainWindow.updatesAsStrings);
if (getNextVersionToClosest == null) getNextVersionToClosest = version;

url = "https://alpha.release-notes.ds.unity3d.com/search?fromVersion=" + closestVersion + "&toVersion=" + version;
url = "https://alpha.release-notes.ds.unity3d.com/search?fromVersion=" + getNextVersionToClosest + "&toVersion=" + version;
}
else
{
Expand Down