@@ -548,9 +548,9 @@ public static void DownloadInBrowser(string url, string version)
548
548
{
549
549
string exeURL = ParseDownloadURLFromWebpage ( version ) ;
550
550
551
- Console . WriteLine ( "exeURL=" + exeURL ) ;
551
+ Console . WriteLine ( "download exeURL= ( " + exeURL + ")" ) ;
552
552
553
- if ( string . IsNullOrEmpty ( exeURL ) == false )
553
+ if ( string . IsNullOrEmpty ( exeURL ) == false && exeURL . StartsWith ( "https" ) == true )
554
554
{
555
555
//SetStatus("Download installer in browser: " + exeURL);
556
556
Process . Start ( exeURL ) ;
@@ -573,9 +573,9 @@ public static string ParseDownloadURLFromWebpage(string version)
573
573
{
574
574
// get correct page url
575
575
string website = "https://unity3d.com/get-unity/download/archive" ;
576
- if ( Tools . VersionIsPatch ( version ) ) website = "https://unity3d.com/unity/qa/patch-releases" ;
577
- if ( Tools . VersionIsBeta ( version ) ) website = "https://unity3d .com/unity /beta/" + version ;
578
- if ( Tools . VersionIsAlpha ( version ) ) website = "https://unity3d .com/unity /alpha/" + version ;
576
+ if ( VersionIsPatch ( version ) ) website = "https://unity3d.com/unity/qa/patch-releases" ;
577
+ if ( VersionIsBeta ( version ) ) website = "https://unity .com/releases/editor /beta/" + version ;
578
+ if ( VersionIsAlpha ( version ) ) website = "https://unity .com/releases/editor /alpha/" + version ;
579
579
580
580
// fix unity server problem, some pages says 404 found if no url params
581
581
website += "?unitylauncherpro" ;
@@ -633,9 +633,14 @@ public static string ParseDownloadURLFromWebpage(string version)
633
633
{
634
634
if ( lines [ i ] . Contains ( "UnityDownloadAssistant.exe" ) )
635
635
{
636
- int start = lines [ i ] . IndexOf ( '"' ) + 1 ;
637
- int end = lines [ i ] . IndexOf ( '"' , start ) ;
638
- url = lines [ i ] . Substring ( start , end - start ) + "#version=" + version ;
636
+ // parse download url from this html line
637
+ string pattern = @"https://beta\.unity3d\.com/download/[a-zA-Z0-9]+/UnityDownloadAssistant\.exe" ;
638
+ Match match = Regex . Match ( lines [ i ] , pattern ) ;
639
+ if ( match . Success )
640
+ {
641
+ url = match . Value ;
642
+ //Console.WriteLine("url= " + url);
643
+ }
639
644
break ;
640
645
}
641
646
}
@@ -646,6 +651,7 @@ public static string ParseDownloadURLFromWebpage(string version)
646
651
if ( string . IsNullOrEmpty ( url ) )
647
652
{
648
653
//SetStatus("Cannot find UnityDownloadAssistant.exe for this version.");
654
+ Console . WriteLine ( "Installer not found from URL.." ) ;
649
655
}
650
656
return url ;
651
657
}
@@ -1774,7 +1780,7 @@ public static void SetBuildStatus(Color color)
1774
1780
// https://unity3d.com/unity/alpha
1775
1781
public static bool IsAlpha ( string version )
1776
1782
{
1777
- if ( string . IsNullOrEmpty ( version ) ) return false ;
1783
+ if ( string . IsNullOrEmpty ( version ) ) return false ;
1778
1784
return version . IndexOf ( "a" , 0 , StringComparison . CurrentCultureIgnoreCase ) > - 1 ;
1779
1785
}
1780
1786
0 commit comments