From e4dfd38dd355faccbbd6ec7d92db8be7555206aa Mon Sep 17 00:00:00 2001 From: Jeddunk Date: Wed, 7 Apr 2021 14:51:49 +0200 Subject: [PATCH] Improved log verbosity. --- GoldbergGUI.Core/Services/GoldbergService.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/GoldbergGUI.Core/Services/GoldbergService.cs b/GoldbergGUI.Core/Services/GoldbergService.cs index 6beb4bf..7ae2c3c 100644 --- a/GoldbergGUI.Core/Services/GoldbergService.cs +++ b/GoldbergGUI.Core/Services/GoldbergService.cs @@ -113,7 +113,8 @@ namespace GoldbergGUI.Core.Services !long.TryParse(File.ReadLines(_userSteamIdPath).First().Trim(), out steamId) && steamId < 76561197960265729 && steamId > 76561202255233023) { - _log.Error("Invalid User Steam ID!"); + _log.Error("Invalid User Steam ID! Using default Steam ID..."); + steamId = DefaultSteamId; } if (File.Exists(_languagePath)) language = File.ReadLines(_languagePath).First().Trim(); @@ -121,6 +122,7 @@ namespace GoldbergGUI.Core.Services customBroadcastIps.AddRange( File.ReadLines(_customBroadcastIpsPath).Select(line => line.Trim())); }).ConfigureAwait(false); + _log.Info("Got global settings."); return new GoldbergGlobalConfiguration { AccountName = accountName, @@ -200,6 +202,7 @@ namespace GoldbergGUI.Core.Services _log.Info("Empty list of custom broadcast IPs! Skipping..."); await Task.Run(() => File.Delete(_customBroadcastIpsPath)).ConfigureAwait(false); } + _log.Info("Setting global configuration finished."); } // If first time, call GenerateInterfaces @@ -410,9 +413,7 @@ namespace GoldbergGUI.Core.Services var httpRequestMessage = new HttpRequestMessage(HttpMethod.Head, downloadUrl); var headResponse = await client.SendAsync(httpRequestMessage).ConfigureAwait(false); var contentLength = headResponse.Content.Headers.ContentLength; - var task = client.GetFileAsync(downloadUrl, fileStream).ConfigureAwait(false); - await task; - if (task.GetAwaiter().IsCompleted) + await client.GetFileAsync(downloadUrl, fileStream).ContinueWith(async t => { await fileStream.DisposeAsync().ConfigureAwait(false); var fileLength = new FileInfo(_goldbergZipPath).Length; @@ -425,7 +426,7 @@ namespace GoldbergGUI.Core.Services { throw new Exception("File size does not match!"); } - } + }).ConfigureAwait(false); } catch (Exception e) {