Improved log verbosity.

This commit is contained in:
Jeddunk 2021-04-07 14:51:49 +02:00
parent 373876c074
commit e4dfd38dd3

View File

@ -113,7 +113,8 @@ namespace GoldbergGUI.Core.Services
!long.TryParse(File.ReadLines(_userSteamIdPath).First().Trim(), out steamId) && !long.TryParse(File.ReadLines(_userSteamIdPath).First().Trim(), out steamId) &&
steamId < 76561197960265729 && steamId > 76561202255233023) 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(); if (File.Exists(_languagePath)) language = File.ReadLines(_languagePath).First().Trim();
@ -121,6 +122,7 @@ namespace GoldbergGUI.Core.Services
customBroadcastIps.AddRange( customBroadcastIps.AddRange(
File.ReadLines(_customBroadcastIpsPath).Select(line => line.Trim())); File.ReadLines(_customBroadcastIpsPath).Select(line => line.Trim()));
}).ConfigureAwait(false); }).ConfigureAwait(false);
_log.Info("Got global settings.");
return new GoldbergGlobalConfiguration return new GoldbergGlobalConfiguration
{ {
AccountName = accountName, AccountName = accountName,
@ -200,6 +202,7 @@ namespace GoldbergGUI.Core.Services
_log.Info("Empty list of custom broadcast IPs! Skipping..."); _log.Info("Empty list of custom broadcast IPs! Skipping...");
await Task.Run(() => File.Delete(_customBroadcastIpsPath)).ConfigureAwait(false); await Task.Run(() => File.Delete(_customBroadcastIpsPath)).ConfigureAwait(false);
} }
_log.Info("Setting global configuration finished.");
} }
// If first time, call GenerateInterfaces // If first time, call GenerateInterfaces
@ -410,9 +413,7 @@ namespace GoldbergGUI.Core.Services
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Head, downloadUrl); var httpRequestMessage = new HttpRequestMessage(HttpMethod.Head, downloadUrl);
var headResponse = await client.SendAsync(httpRequestMessage).ConfigureAwait(false); var headResponse = await client.SendAsync(httpRequestMessage).ConfigureAwait(false);
var contentLength = headResponse.Content.Headers.ContentLength; var contentLength = headResponse.Content.Headers.ContentLength;
var task = client.GetFileAsync(downloadUrl, fileStream).ConfigureAwait(false); await client.GetFileAsync(downloadUrl, fileStream).ContinueWith(async t =>
await task;
if (task.GetAwaiter().IsCompleted)
{ {
await fileStream.DisposeAsync().ConfigureAwait(false); await fileStream.DisposeAsync().ConfigureAwait(false);
var fileLength = new FileInfo(_goldbergZipPath).Length; var fileLength = new FileInfo(_goldbergZipPath).Length;
@ -425,7 +426,7 @@ namespace GoldbergGUI.Core.Services
{ {
throw new Exception("File size does not match!"); throw new Exception("File size does not match!");
} }
} }).ConfigureAwait(false);
} }
catch (Exception e) catch (Exception e)
{ {