From f829743b6c0be3a6899435a468da8643c85aa49b Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 11 Mar 2021 19:32:25 +0100 Subject: [PATCH] Updating - Fix crash when client has internet Updating - Check for updates periodically and when window opens (if auto-update enabled) Webserver - Don't write wildcard to webserver.txt --- src/Artemis.Core/Constants.cs | 11 ++- src/Artemis.Core/Services/Core/BuildInfo.cs | 5 ++ .../Services/WebServer/WebServerService.cs | 2 +- src/Artemis.UI/Artemis.UI.csproj | 3 - .../Settings/Dialogs/UpdateDialogView.xaml | 21 ++++-- .../Settings/Dialogs/UpdateDialogViewModel.cs | 69 ++++++++++++------- .../General/GeneralSettingsTabViewModel.cs | 18 +++-- src/Artemis.UI/Services/UpdateService.cs | 42 ++++++++--- src/Artemis.UI/buildinfo.json | 6 -- 9 files changed, 120 insertions(+), 57 deletions(-) delete mode 100644 src/Artemis.UI/buildinfo.json diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs index effc348c2..96e72a0f6 100644 --- a/src/Artemis.Core/Constants.cs +++ b/src/Artemis.Core/Constants.cs @@ -46,7 +46,14 @@ namespace Artemis.Core /// public static readonly BuildInfo BuildInfo = File.Exists(Path.Combine(ApplicationFolder, "buildinfo.json")) ? JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(ApplicationFolder, "buildinfo.json"))) - : new BuildInfo(); + : new BuildInfo + { + IsLocalBuild = true, + BuildId = 1337, + BuildNumber = 1337, + SourceBranch = "local", + SourceVersion = "local" + }; /// /// The plugin used by core components of Artemis @@ -108,6 +115,6 @@ namespace Artemis.Core typeof(float), typeof(double), typeof(decimal) - }; + }; } } \ No newline at end of file diff --git a/src/Artemis.Core/Services/Core/BuildInfo.cs b/src/Artemis.Core/Services/Core/BuildInfo.cs index a2caaa3cf..5de246d43 100644 --- a/src/Artemis.Core/Services/Core/BuildInfo.cs +++ b/src/Artemis.Core/Services/Core/BuildInfo.cs @@ -38,5 +38,10 @@ namespace Artemis.Core.Services.Core /// [JsonProperty] public string SourceVersion { get; internal set; } = null!; + + /// + /// Gets a boolean indicating whether the current build is a local build + /// + public bool IsLocalBuild { get; internal set; } } } \ No newline at end of file diff --git a/src/Artemis.Core/Services/WebServer/WebServerService.cs b/src/Artemis.Core/Services/WebServer/WebServerService.cs index d74035da2..55c7cbcfb 100644 --- a/src/Artemis.Core/Services/WebServer/WebServerService.cs +++ b/src/Artemis.Core/Services/WebServer/WebServerService.cs @@ -61,7 +61,7 @@ namespace Artemis.Core.Services server.StateChanged += (s, e) => _logger.Verbose("WebServer new state - {state}", e.NewState); // Store the URL in a webserver.txt file so that remote applications can find it - File.WriteAllText(Path.Combine(Constants.DataFolder, "webserver.txt"), url); + File.WriteAllText(Path.Combine(Constants.DataFolder, "webserver.txt"), $"http://localhost:{_webServerPortSetting.Value}/"); return server; } diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 451ff0b03..127c6a5c9 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -334,9 +334,6 @@ - - PreserveNewest - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml b/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml index 88ab9c7de..583f3828f 100644 --- a/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml +++ b/src/Artemis.UI/Screens/Settings/Dialogs/UpdateDialogView.xaml @@ -32,13 +32,20 @@ - - - - - - - + + + + + + + + + + Couldn't retrieve changes, sorry :( + +