Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9bb433

Browse files
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.
1 parent732d859 commite9bb433

File tree

3 files changed

+57
-26
lines changed

3 files changed

+57
-26
lines changed

‎UnityLauncherPro/MainWindow.xaml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,10 @@
512512
<LabelContent="Download&amp; Install"Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
513513
</Button>
514514
<Button Grid.Column="3"Style="{StaticResource CustomButton}"x:Name="btnOpenWebsite"Margin="5,0,0,0"BorderBrush="{x:Null}"Click="BtnOpenWebsite_Click" >
515-
</Button>
516-
<Button Grid.Column="3"Style="{StaticResource CustomButton}"x:Name="btnOpenWebsite_Copy"Margin="5,0,0,0"BorderBrush="{x:Null}"Click="BtnOpenWebsite_Click" >
517515
<LabelContent="Release Notes"Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Control}, Mode=FindAncestor}}" />
518516
</Button>
519-
<Button Grid.Column="4"Style="{StaticResource CustomButton}"x:Name="btnOpenWebsite_Copy2"Margin="5,0,0,0"BorderBrush="{x:Null}"Click="BtnOpenWebsite_Click"ToolTip="ShowAll Releasenotes betweenthisversionon the older, closest one installed.&lt;br&gt;Only works for final versions." >
520-
<LabelContent="Cumulated Release Notes"Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Control}, Mode=FindAncestor}}" />
517+
<Button Grid.Column="4"Style="{StaticResource CustomButton}"x:Name="btnShowCumulatedReleaseNotes"Margin="5,0,0,0"BorderBrush="{x:Null}"Click="BtnShowCumulatedReleaseNotes_Click"ToolTip="Showall ReleaseNotes betweenthe selectedversionand the older, closest one installed.Only works for final and patch versions." >
518+
<LabelContent="Cumulative Release Notes"Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Control}, Mode=FindAncestor}}" />
521519
</Button>
522520
</Grid>
523521
</Grid>

‎UnityLauncherPro/MainWindow.xaml.cs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ void Start()
140140

141141
// clear updates grid
142142
dataGridUpdates.Items.Clear();
143+
dataGridUpdates.SelectionChanged+=DataGridUpdates_SelectionChanged;
143144

144145
// clear buildreport grids
145146
gridBuildReport.Items.Clear();
@@ -177,6 +178,18 @@ void Start()
177178
isInitializing=false;
178179
}
179180

181+
privatevoidDataGridUpdates_SelectionChanged(objectsender,SelectionChangedEventArgse)
182+
{
183+
varselectedUp=GetSelectedUpdate();
184+
boolshowCumulative=false;
185+
if(selectedUp!=null)
186+
{
187+
varunityVer=GetSelectedUpdate().Version;
188+
showCumulative=Tools.HasAlphaReleaseNotes(unityVer);
189+
}
190+
btnShowCumulatedReleaseNotes.IsEnabled=showCumulative;
191+
}
192+
180193
// bring old window to front, but needs matching appname.. https://stackoverflow.com/a/36804161/5452781
181194
privatestaticvoidActivateOtherWindow()
182195
{
@@ -1542,6 +1555,12 @@ private void BtnOpenWebsite_Click(object sender, RoutedEventArgs e)
15421555
Tools.OpenReleaseNotes(unity?.Version);
15431556
}
15441557

1558+
privatevoidBtnShowCumulatedReleaseNotes_Click(objectsender,RoutedEventArgse)
1559+
{
1560+
varunity=GetSelectedUpdate();
1561+
Tools.OpenReleaseNotes_Cumulative(unity?.Version);
1562+
}
1563+
15451564
privatevoidChkMinimizeToTaskbar_CheckedChanged(objectsender,RoutedEventArgse)
15461565
{
15471566
if(this.IsActive==false)return;// dont run code on window init

‎UnityLauncherPro/Tools.cs‎

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -588,36 +588,20 @@ public static bool VersionIsChinese(string version)
588588

589589

590590
//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.
591-
publicstaticboolHasAlphaReleaseNotes(stringversion)=>version.Contains("f")||version.Contains("p");
591+
publicstaticboolHasAlphaReleaseNotes(stringversion)=>VersionIsArchived(version)||VersionIsPatch(version);
592+
593+
publicstaticstringGetAlphaReleaseNotesURL(stringfromVersion,stringtoVersion=null)
594+
=>"https://alpha.release-notes.ds.unity3d.com/search?fromVersion="+fromVersion+"&toVersion="+(toVersion!=null?toVersion:fromVersion);
592595

593596
// open release notes page in browser
594597
publicstaticboolOpenReleaseNotes(stringversion)
595598
{
596599
boolresult=false;
597600
if(string.IsNullOrEmpty(version))returnfalse;
598-
599601
stringurl=null;
600-
if(Properties.Settings.Default.useAlphaReleaseNotes&&HasAlphaReleaseNotes(version))
602+
if(Properties.Settings.Default.useAlphaReleaseNotes&&HasAlphaReleaseNotes(version))
601603
{
602-
//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"
603-
//so if we find a good installed candidate, we need the version just above it (installed or not) that has release notes page
604-
varcomparisonVersion=version;
605-
varclosestInstalledVersion=Tools.FindNearestVersion(version,MainWindow.unityInstalledVersions.Keys.ToList(),true);
606-
if(closestInstalledVersion!=null)
607-
{
608-
comparisonVersion=closestInstalledVersion;
609-
stringnextFinalVersionAfterInstalled=closestInstalledVersion;
610-
611-
//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.
612-
do
613-
nextFinalVersionAfterInstalled=Tools.FindNearestVersion(nextFinalVersionAfterInstalled,MainWindow.updatesAsStrings);
614-
while(nextFinalVersionAfterInstalled!=null&&!HasAlphaReleaseNotes(nextFinalVersionAfterInstalled));
615-
616-
if(nextFinalVersionAfterInstalled!=null)comparisonVersion=nextFinalVersionAfterInstalled;
617-
618-
}
619-
620-
url="https://alpha.release-notes.ds.unity3d.com/search?fromVersion="+comparisonVersion+"&toVersion="+version;
604+
url=GetAlphaReleaseNotesURL(version);
621605
}
622606
else
623607
{
@@ -630,6 +614,36 @@ public static bool OpenReleaseNotes(string version)
630614
returnresult;
631615
}
632616

617+
publicstaticboolOpenReleaseNotes_Cumulative(stringversion)
618+
{
619+
boolresult=false;
620+
if(string.IsNullOrEmpty(version))returnfalse;
621+
622+
stringurl=null;
623+
varcomparisonVersion=version;
624+
//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"
625+
//so if we find a good installed candidate, we need the version just above it (installed or not) that has release notes page
626+
varclosestInstalledVersion=Tools.FindNearestVersion(version,MainWindow.unityInstalledVersions.Keys.ToList(),true);
627+
if(closestInstalledVersion!=null)
628+
{
629+
comparisonVersion=closestInstalledVersion;
630+
stringnextFinalVersionAfterInstalled=closestInstalledVersion;
631+
632+
//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.
633+
do
634+
nextFinalVersionAfterInstalled=Tools.FindNearestVersion(nextFinalVersionAfterInstalled,MainWindow.updatesAsStrings);
635+
while(nextFinalVersionAfterInstalled!=null&&!HasAlphaReleaseNotes(nextFinalVersionAfterInstalled));
636+
637+
if(nextFinalVersionAfterInstalled!=null)comparisonVersion=nextFinalVersionAfterInstalled;
638+
639+
}
640+
url=GetAlphaReleaseNotesURL(comparisonVersion,version);
641+
642+
OpenURL(url);
643+
result=true;
644+
returnresult;
645+
}
646+
633647
publicstaticvoidOpenURL(stringurl)
634648
{
635649
Process.Start(url);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp