diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs
index cfb3b0551..6c31f21ba 100644
--- a/src/Artemis.Core/Constants.cs
+++ b/src/Artemis.Core/Constants.cs
@@ -62,9 +62,16 @@ public static class Constants
///
/// The current API version for plugins
///
- public static readonly int PluginApiVersion = int.Parse(CoreAssembly.GetCustomAttributes().First(a => a.Key == "PluginApiVersion").Value ??
+ public static readonly int PluginApiVersion = int.Parse(CoreAssembly.GetCustomAttributes().FirstOrDefault(a => a.Key == "PluginApiVersion")?.Value ??
throw new InvalidOperationException("Cannot find PluginApiVersion metadata in assembly"));
+ ///
+ /// The current version of the application
+ ///
+ public static readonly string CurrentVersion = CoreAssembly.GetCustomAttribute()!.InformationalVersion != "1.0.0"
+ ? CoreAssembly.GetCustomAttribute()!.InformationalVersion
+ : "1.2023.0212.2-feature-gh-actions";
+
///
/// The plugin info used by core components of Artemis
///
@@ -73,21 +80,6 @@ public static class Constants
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = new Version(2, 0)
};
- ///
- /// The build information related to the currently running Artemis build
- /// Information is retrieved from buildinfo.json
- ///
- public static readonly BuildInfo BuildInfo = File.Exists(Path.Combine(ApplicationFolder, "buildinfo.json"))
- ? JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(ApplicationFolder, "buildinfo.json")))!
- : new BuildInfo
- {
- IsLocalBuild = true,
- BuildId = 1337,
- BuildNumber = 1337,
- SourceBranch = "local",
- SourceVersion = "local"
- };
-
///
/// The plugin used by core components of Artemis
///
diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs
index 933d3d3c3..ee1352c8d 100644
--- a/src/Artemis.Core/Services/CoreService.cs
+++ b/src/Artemis.Core/Services/CoreService.cs
@@ -200,23 +200,17 @@ internal class CoreService : ICoreService
if (IsInitialized)
throw new ArtemisCoreException("Cannot initialize the core as it is already initialized.");
- AssemblyInformationalVersionAttribute? versionAttribute = typeof(CoreService).Assembly.GetCustomAttribute();
- _logger.Information(
- "Initializing Artemis Core version {version}, build {buildNumber} branch {branch}.",
- versionAttribute?.InformationalVersion,
- Constants.BuildInfo.BuildNumber,
- Constants.BuildInfo.SourceBranch
- );
- _logger.Information("Startup arguments: {args}", Constants.StartupArguments);
- _logger.Information("Elevated permissions: {perms}", IsElevated);
- _logger.Information("Stopwatch high resolution: {perms}", Stopwatch.IsHighResolution);
+ _logger.Information("Initializing Artemis Core version {CurrentVersion}", Constants.CurrentVersion);
+ _logger.Information("Startup arguments: {StartupArguments}", Constants.StartupArguments);
+ _logger.Information("Elevated permissions: {IsElevated}", IsElevated);
+ _logger.Information("Stopwatch high resolution: {IsHighResolution}", Stopwatch.IsHighResolution);
ApplyLoggingLevel();
// Don't remove even if it looks useless
// Just this line should prevent a certain someone from removing HidSharp as an unused dependency as well
Version? hidSharpVersion = Assembly.GetAssembly(typeof(HidDevice))!.GetName().Version;
- _logger.Debug("Forcing plugins to use HidSharp {hidSharpVersion}", hidSharpVersion);
+ _logger.Debug("Forcing plugins to use HidSharp {HidSharpVersion}", hidSharpVersion);
// Initialize the services
_pluginManagementService.CopyBuiltInPlugins();
diff --git a/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs b/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs
index 40c2600a4..331352a9a 100644
--- a/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs
+++ b/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs
@@ -111,7 +111,7 @@ public class AutoRunProvider : IAutoRunProvider
///
public async Task EnableAutoRun(bool recreate, int autoRunDelay)
{
- if (Constants.BuildInfo.IsLocalBuild)
+ if (Constants.CurrentVersion == "development")
return;
await CleanupOldAutorun();
diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs
index 0ce8312c7..8fa53983e 100644
--- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs
@@ -57,7 +57,7 @@ public class AboutTabViewModel : ActivatableViewModelBase
private async Task Activate()
{
AssemblyInformationalVersionAttribute? versionAttribute = typeof(AboutTabViewModel).Assembly.GetCustomAttribute();
- Version = $"Version {versionAttribute?.InformationalVersion} build {Constants.BuildInfo.BuildNumberDisplay}";
+ Version = $"Version {Constants.CurrentVersion}";
try
{
diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml
index 6528d8b04..d70248659 100644
--- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml
+++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml
@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settings="clr-namespace:Artemis.UI.Screens.Settings"
xmlns:updating="clr-namespace:Artemis.UI.Screens.Settings.Updating"
+ xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1400"
x:Class="Artemis.UI.Screens.Settings.ReleasesTabView"
x:DataType="settings:ReleasesTabViewModel">
@@ -12,15 +13,29 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseViewModel.cs b/src/Artemis.UI/Screens/Settings/Updating/ReleaseViewModel.cs
index ce00c716e..7d4d34f65 100644
--- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseViewModel.cs
@@ -61,6 +61,7 @@ public class ReleaseViewModel : ActivatableViewModelBase
else
throw new PlatformNotSupportedException("Cannot auto update on the current platform");
+
ReleaseId = releaseId;
Version = version;
CreatedAt = createdAt;
@@ -144,6 +145,8 @@ public class ReleaseViewModel : ActivatableViewModelBase
set => RaiseAndSetIfChanged(ref _installationFinished, value);
}
+ public bool IsCurrentVersion => Version == Constants.CurrentVersion;
+
public void NavigateToSource()
{
Utilities.OpenUrl($"https://github.com/Artemis-RGB/Artemis/commit/{Commit}");
diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs
index dd72303e1..5008f559a 100644
--- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs
+++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs
@@ -25,29 +25,29 @@ public class StartupWizardViewModel : DialogViewModelBase
private readonly IAutoRunProvider? _autoRunProvider;
private readonly IRgbService _rgbService;
private readonly ISettingsService _settingsService;
- private readonly IUpdateService _updateService;
private readonly IWindowService _windowService;
private int _currentStep;
private bool _showContinue;
private bool _showFinish;
private bool _showGoBack;
- public StartupWizardViewModel(IContainer container, ISettingsService settingsService, IRgbService rgbService, IPluginManagementService pluginManagementService, IWindowService windowService,
- IUpdateService updateService, ISettingsVmFactory settingsVmFactory)
+ public StartupWizardViewModel(IContainer container,
+ ISettingsService settingsService,
+ IRgbService rgbService,
+ IPluginManagementService pluginManagementService,
+ IWindowService windowService,
+ ISettingsVmFactory settingsVmFactory)
{
_settingsService = settingsService;
_rgbService = rgbService;
_windowService = windowService;
- _updateService = updateService;
_autoRunProvider = container.Resolve(IfUnresolved.ReturnDefault);
Continue = ReactiveCommand.Create(ExecuteContinue);
GoBack = ReactiveCommand.Create(ExecuteGoBack);
SkipOrFinishWizard = ReactiveCommand.Create(ExecuteSkipOrFinishWizard);
SelectLayout = ReactiveCommand.Create(ExecuteSelectLayout);
-
- AssemblyInformationalVersionAttribute? versionAttribute = typeof(StartupWizardViewModel).Assembly.GetCustomAttribute();
- Version = $"Version {versionAttribute?.InformationalVersion} build {Constants.BuildInfo.BuildNumberDisplay}";
+ Version = $"Version {Constants.CurrentVersion}";
// Take all compatible plugins that have an always-enabled device provider
DeviceProviders = new ObservableCollection(pluginManagementService.GetAllPlugins()
diff --git a/src/Artemis.UI/Services/Updating/IUpdateService.cs b/src/Artemis.UI/Services/Updating/IUpdateService.cs
index db716859e..9c4ad84c8 100644
--- a/src/Artemis.UI/Services/Updating/IUpdateService.cs
+++ b/src/Artemis.UI/Services/Updating/IUpdateService.cs
@@ -6,7 +6,6 @@ namespace Artemis.UI.Services.Updating;
public interface IUpdateService : IArtemisUIService
{
- string? CurrentVersion { get; }
IGetNextRelease_NextPublishedRelease? CachedLatestRelease { get; }
Task CacheLatestRelease();
diff --git a/src/Artemis.UI/Services/Updating/UpdateService.cs b/src/Artemis.UI/Services/Updating/UpdateService.cs
index 14cb8f21e..2d95b9230 100644
--- a/src/Artemis.UI/Services/Updating/UpdateService.cs
+++ b/src/Artemis.UI/Services/Updating/UpdateService.cs
@@ -1,5 +1,4 @@
using System;
-using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Artemis.Core;
@@ -8,7 +7,6 @@ using Artemis.Storage.Entities.General;
using Artemis.Storage.Repositories.Interfaces;
using Artemis.UI.Shared.Services.MainWindow;
using Artemis.WebClient.Updating;
-using Avalonia.Threading;
using Serilog;
using StrawberryShake;
using Timer = System.Timers.Timer;
@@ -113,25 +111,16 @@ public class UpdateService : IUpdateService
public IGetNextRelease_NextPublishedRelease? CachedLatestRelease { get; private set; }
- public string? CurrentVersion
- {
- get
- {
- object[] attributes = typeof(UpdateService).Assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
- return attributes.Length == 0 ? null : ((AssemblyInformationalVersionAttribute) attributes[0]).InformationalVersion;
- }
- }
-
///
public async Task CacheLatestRelease()
{
- IOperationResult result = await _updatingClient.GetNextRelease.ExecuteAsync(CurrentVersion, _channel.Value, _updatePlatform);
+ IOperationResult result = await _updatingClient.GetNextRelease.ExecuteAsync(Constants.CurrentVersion, _channel.Value, _updatePlatform);
CachedLatestRelease = result.Data?.NextPublishedRelease;
}
public async Task CheckForUpdate()
{
- IOperationResult result = await _updatingClient.GetNextRelease.ExecuteAsync(CurrentVersion, _channel.Value, _updatePlatform);
+ IOperationResult result = await _updatingClient.GetNextRelease.ExecuteAsync(Constants.CurrentVersion, _channel.Value, _updatePlatform);
result.EnsureNoErrors();
// Update cache