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

Commit710e14d

Browse files
committed
add full installer exe download option to DownloadInBrowser(), add await for extract urls (got stuck otherwise),
1 parentca48d57 commit710e14d

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

‎UnityLauncherPro/GetUnityUpdates.cs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static async Task<string> FetchDownloadUrl(string unityVersion)
5151
try
5252
{
5353
stringresponseString=awaitClient.GetStringAsync(apiUrl);
54-
returnExtractDownloadUrl(responseString,unityVersion);
54+
returnawaitExtractDownloadUrlAsync(responseString,unityVersion);
5555
}
5656
catch(Exceptione)
5757
{
@@ -60,8 +60,9 @@ public static async Task<string> FetchDownloadUrl(string unityVersion)
6060
}
6161
}
6262

63-
privatestaticstringExtractDownloadUrl(stringjson,stringunityVersion)
63+
privatestaticasyncTask<string>ExtractDownloadUrlAsync(stringjson,stringunityVersion)
6464
{
65+
6566
intresultsIndex=json.IndexOf("\"results\":");
6667
if(resultsIndex==-1)returnnull;
6768

@@ -87,10 +88,9 @@ private static string ExtractDownloadUrl(string json, string unityVersion)
8788
if(!string.IsNullOrEmpty(downloadUrl)&&!string.IsNullOrEmpty(shortRevision))
8889
{
8990
intrevisionPosition=downloadUrl.LastIndexOf(shortRevision,StringComparison.Ordinal)+shortRevision.Length+1;
90-
stringassistantUrl=downloadUrl.Substring(0,revisionPosition)+
91-
$"UnityDownloadAssistant-{unityVersion}.exe";
91+
stringassistantUrl=downloadUrl.Substring(0,revisionPosition)+$"UnityDownloadAssistant-{unityVersion}.exe";
9292

93-
if(CheckAssistantUrl(assistantUrl).Result)
93+
if(awaitCheckAssistantUrl(assistantUrl))
9494
{
9595
Console.WriteLine("Assistant download URL found.");
9696
returnassistantUrl;
@@ -115,8 +115,9 @@ private static async Task<bool> CheckAssistantUrl(string assistantUrl)
115115
returnresponse.IsSuccessStatusCode;
116116
}
117117
}
118-
catch
118+
catch(Exceptionex)
119119
{
120+
Console.WriteLine($"Request failed:{ex.Message}");
120121
returnfalse;
121122
}
122123
}

‎UnityLauncherPro/MainWindow.xaml.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ private void BtnDownloadInBrowser_Click(object sender, RoutedEventArgs e)
15171517
privatevoidBtnDownloadInBrowserFull_Click(objectsender,RoutedEventArgse)
15181518
{
15191519
varunity=GetSelectedUpdate();
1520-
Tools.DownloadInBrowser(unity?.Version);
1520+
Tools.DownloadInBrowser(unity?.Version,true);
15211521
}
15221522

15231523
privatevoidbtnDownloadInstallUpdate_Click(objectsender,RoutedEventArgse)

‎UnityLauncherPro/Tools.cs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,16 @@ public static void OpenURL(string url)
659659
Process.Start(url);
660660
}
661661

662-
publicstaticasyncvoidDownloadInBrowser(stringversion)
662+
publicstaticasyncvoidDownloadInBrowser(stringversion,boolpreferFullInstaller=false)
663663
{
664664
if(version==null)return;
665665
stringexeURL=awaitGetUnityUpdates.FetchDownloadUrl(version);
666666

667+
if(preferFullInstaller==true)
668+
{
669+
exeURL=exeURL.Replace("UnityDownloadAssistant-"+version+".exe","Windows64EditorInstaller/UnitySetup64-"+version+".exe");
670+
}
671+
667672
Console.WriteLine("DownloadInBrowser exeURL= '"+exeURL+"'");
668673

669674
if(string.IsNullOrEmpty(exeURL)==false&&exeURL.StartsWith("https"))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp