Skip to content

Commit

Permalink
Launcher updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Fma965 committed Nov 6, 2022
1 parent c483fdd commit 7438303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions Launcher/UpdateCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ public async Task<bool> Execute(LauncherPrefs.ReleaseType releaseType, Upgrading
// Get Correct Release
switch (releaseType)
{
// Continuous Intergration,
case LauncherPrefs.ReleaseType.Alpha:
// Gets latest build via API at Cyanlabs.net
WebClient wc = new();
ciRelease = JsonConvert.DeserializeObject<CIRelease>(wc.DownloadString(new Uri("https://api.cyanlabs.net/ci/Syn3Updater/latest")));
break;

// Beta
case LauncherPrefs.ReleaseType.Beta:
// Get all GitHub releases for Syn3Updater and sets the value of 'latest' to the first (newest) retrieved
Expand All @@ -73,7 +66,9 @@ public async Task<bool> Execute(LauncherPrefs.ReleaseType releaseType, Upgrading
// Catch RateLimitExceededException exception, bypasses update check and launches Syn3Updater.exe
catch (RateLimitExceededException)
{
UpgradingWindow.Vm.Message = "GitHub Request Limit Exceeded!\nSkipping Update Check";
if (File.Exists("Syn3Updater.exe")) Process.Start("Syn3Updater.exe", "/launcher");
await Task.Delay(5000);
Application.Current.Shutdown();
return false;
}
Expand Down Expand Up @@ -105,12 +100,7 @@ public async Task<bool> Execute(LauncherPrefs.ReleaseType releaseType, Upgrading
// Do the actual file download of the first Asset in the chosen GitHub Release or the CI download link with the previously created WebClient
try
{
await wc.DownloadFileTaskAsync(
releaseType == LauncherPrefs.ReleaseType.Alpha
// ReSharper disable once PossibleNullReferenceException
? new Uri(ciRelease.Download)
// ReSharper disable once PossibleNullReferenceException
: new Uri(githubrelease.Assets.First(x => x.ContentType == "application/x-zip-compressed").BrowserDownloadUrl), zipPath);
await wc.DownloadFileTaskAsync(new Uri(githubrelease.Assets.First(x => x.ContentType == "application/x-zip-compressed").BrowserDownloadUrl), zipPath);
}
catch (WebException)
{
Expand Down
4 changes: 2 additions & 2 deletions Launcher/UpgradingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
</Viewbox>
</DockPanel>
<TextBlock Cursor="Wait" x:Name="LoadingText" HorizontalAlignment="Left" Foreground="Black"
VerticalAlignment="Top" Margin="418,222,0,0" Text="{Binding Message}" Width="360" TextAlignment="Center" FontSize="17" FontWeight="Bold" />
VerticalAlignment="Bottom" Margin="418,0,0,182" Text="{Binding Message}" Width="360" TextAlignment="Center" FontSize="17" FontWeight="Bold" />
<ProgressBar x:Name="ProgressBar" Foreground="White"
Background="{x:Static fluentWpf:AccentColors.ImmersiveSystemAccentBrush}" BorderBrush="{x:Null}"
Margin="431,246,35,166" Value="{Binding Percentage}" RenderTransformOrigin="0.5,0.5">
Margin="431,254,35,158" Value="{Binding Percentage}" RenderTransformOrigin="0.5,0.5">
<ProgressBar.RenderTransform>
<TransformGroup>
<ScaleTransform />
Expand Down

0 comments on commit 7438303

Please sign in to comment.