@@ -548,9 +548,9 @@ public static void DownloadInBrowser(string url, string version)
548548 {
549549 string exeURL = ParseDownloadURLFromWebpage ( version ) ;
550550
551- Console . WriteLine ( "exeURL=" + exeURL ) ;
551+ Console . WriteLine ( "download exeURL= ( " + exeURL + ")" ) ;
552552
553- if ( string . IsNullOrEmpty ( exeURL ) == false )
553+ if ( string . IsNullOrEmpty ( exeURL ) == false && exeURL . StartsWith ( "https" ) == true )
554554 {
555555 //SetStatus("Download installer in browser: " + exeURL);
556556 Process . Start ( exeURL ) ;
@@ -573,9 +573,9 @@ public static string ParseDownloadURLFromWebpage(string version)
573573 {
574574 // get correct page url
575575 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 ;
579579
580580 // fix unity server problem, some pages says 404 found if no url params
581581 website += "?unitylauncherpro" ;
@@ -633,9 +633,14 @@ public static string ParseDownloadURLFromWebpage(string version)
633633 {
634634 if ( lines [ i ] . Contains ( "UnityDownloadAssistant.exe" ) )
635635 {
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+ }
639644 break ;
640645 }
641646 }
@@ -646,6 +651,7 @@ public static string ParseDownloadURLFromWebpage(string version)
646651 if ( string . IsNullOrEmpty ( url ) )
647652 {
648653 //SetStatus("Cannot find UnityDownloadAssistant.exe for this version.");
654+ Console . WriteLine ( "Installer not found from URL.." ) ;
649655 }
650656 return url ;
651657 }
@@ -1774,7 +1780,7 @@ public static void SetBuildStatus(Color color)
17741780 // https://unity3d.com/unity/alpha
17751781 public static bool IsAlpha ( string version )
17761782 {
1777- if ( string . IsNullOrEmpty ( version ) ) return false ;
1783+ if ( string . IsNullOrEmpty ( version ) ) return false ;
17781784 return version . IndexOf ( "a" , 0 , StringComparison . CurrentCultureIgnoreCase ) > - 1 ;
17791785 }
17801786
0 commit comments