@@ -531,6 +531,7 @@ public static string GetUnityReleaseURL(string version)
531
531
532
532
var cleanVersion = CleanVersionNumber ( version ) ;
533
533
string url = $ "https://unity.com/releases/editor/whats-new/{ cleanVersion } #notes";
534
+
534
535
//if (VersionIsArchived(version) == true)
535
536
//{
536
537
// // remove f#, TODO should remove c# from china version ?
@@ -608,15 +609,17 @@ public static bool OpenReleaseNotes(string version)
608
609
{
609
610
bool result = false ;
610
611
if ( string . IsNullOrEmpty ( version ) ) return false ;
612
+
611
613
string url = null ;
612
614
if ( Properties . Settings . Default . useAlphaReleaseNotes && HasAlphaReleaseNotes ( version ) )
613
615
{
614
616
url = GetAlphaReleaseNotesURL ( version ) ;
615
617
}
616
618
else
617
619
{
618
- url = Tools . GetUnityReleaseURL ( version ) ;
620
+ url = GetUnityReleaseURL ( version ) ;
619
621
}
622
+
620
623
if ( string . IsNullOrEmpty ( url ) ) return false ;
621
624
622
625
OpenURL ( url ) ;
@@ -847,8 +850,20 @@ public static string DownloadHTML(string url)
847
850
public static string CleanVersionNumber ( string version )
848
851
{
849
852
if ( string . IsNullOrEmpty ( version ) ) return null ;
850
- // note old patch versions still contains p## in the end
851
- return Regex . Replace ( version , @"[f|a|b][0-9]{1,2}" , "" , RegexOptions . IgnoreCase ) ;
853
+
854
+ var split = version . Split ( '.' ) ;
855
+ float parsedVersion = float . Parse ( $ "{ split [ 0 ] } .{ split [ 1 ] } ") ;
856
+ // 2023.3 and newer Alpha releases, no replace
857
+ if ( IsAlpha ( version ) && parsedVersion >= 2023.3 )
858
+ {
859
+ // do nothing
860
+ }
861
+ else
862
+ {
863
+ // note old patch versions still contains p## in the end
864
+ version = Regex . Replace ( version , @"[f|a|b][0-9]{1,2}" , "" , RegexOptions . IgnoreCase ) ;
865
+ }
866
+ return version ;
852
867
}
853
868
854
869
private static string FetchUnityVersionNumberFromHTML ( string url )
@@ -2216,7 +2231,7 @@ internal static void OpenCustomAssetPath()
2216
2231
}
2217
2232
}
2218
2233
}
2219
-
2234
+
2220
2235
private static async Task < bool > DownloadFileAsync ( string fileUrl , string destinationPath )
2221
2236
{
2222
2237
var cancellationTokenSource = new CancellationTokenSource ( ) ;
@@ -2229,25 +2244,25 @@ private static async Task<bool> DownloadFileAsync(string fileUrl, string destina
2229
2244
using ( var client = new HttpClient ( ) )
2230
2245
using ( var response = await client . GetAsync ( fileUrl , HttpCompletionOption . ResponseHeadersRead , cancellationTokenSource . Token ) )
2231
2246
{
2232
- response . EnsureSuccessStatusCode ( ) ;
2247
+ response . EnsureSuccessStatusCode ( ) ;
2233
2248
2234
- var totalBytes = response . Content . Headers . ContentLength ?? 1 ;
2235
- var buffer = new byte [ 8192 ] ;
2236
- var totalRead = 0 ;
2249
+ var totalBytes = response . Content . Headers . ContentLength ?? 1 ;
2250
+ var buffer = new byte [ 8192 ] ;
2251
+ var totalRead = 0 ;
2237
2252
2238
- using ( var contentStream = await response . Content . ReadAsStreamAsync ( ) )
2239
- using ( var fileStream = new FileStream ( destinationPath , FileMode . Create , FileAccess . Write ,
2240
- FileShare . None , buffer . Length , true ) )
2253
+ using ( var contentStream = await response . Content . ReadAsStreamAsync ( ) )
2254
+ using ( var fileStream = new FileStream ( destinationPath , FileMode . Create , FileAccess . Write ,
2255
+ FileShare . None , buffer . Length , true ) )
2256
+ {
2257
+ int bytesRead ;
2258
+ while ( ( bytesRead = await contentStream . ReadAsync ( buffer , 0 , buffer . Length , cancellationTokenSource . Token ) ) > 0 )
2241
2259
{
2242
- int bytesRead ;
2243
- while ( ( bytesRead = await contentStream . ReadAsync ( buffer , 0 , buffer . Length , cancellationTokenSource . Token ) ) > 0 )
2244
- {
2245
- await fileStream . WriteAsync ( buffer , 0 , bytesRead , cancellationTokenSource . Token ) ;
2246
- totalRead += bytesRead ;
2247
- progressWindow . UpdateProgress ( new DownloadProgress ( totalRead , totalBytes ) ) ;
2248
- }
2249
- result = true ;
2260
+ await fileStream . WriteAsync ( buffer , 0 , bytesRead , cancellationTokenSource . Token ) ;
2261
+ totalRead += bytesRead ;
2262
+ progressWindow . UpdateProgress ( new DownloadProgress ( totalRead , totalBytes ) ) ;
2250
2263
}
2264
+ result = true ;
2265
+ }
2251
2266
}
2252
2267
}
2253
2268
catch ( TaskCanceledException )
0 commit comments