Skip to content

Commit

Permalink
Merge pull request #150 from SixParQuatre/master
Browse files Browse the repository at this point in the history
Alpha Release Notes: Add support for 6000.0f version and fix bugs in comparison.
  • Loading branch information
unitycoder authored May 6, 2024
2 parents 8056e1e + bbf6a64 commit f7ec679
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
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

0 comments on commit f7ec679

Please sign in to comment.