mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Update built-in plugins by build date not by version
This commit is contained in:
parent
a2e20b3821
commit
d8390d306c
@ -81,7 +81,7 @@ public static class Constants
|
||||
/// </summary>
|
||||
public static readonly PluginInfo CorePluginInfo = new()
|
||||
{
|
||||
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = new Version(2, 0)
|
||||
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = CurrentVersion
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -25,7 +25,7 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
|
||||
private Plugin _plugin = null!;
|
||||
private Uri? _repository;
|
||||
private bool _requiresAdmin;
|
||||
private Version _version = null!;
|
||||
private string _version = null!;
|
||||
private Uri? _website;
|
||||
|
||||
internal PluginInfo()
|
||||
@ -107,7 +107,7 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
|
||||
/// The version of the plugin
|
||||
/// </summary>
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
public Version Version
|
||||
public string Version
|
||||
{
|
||||
get => _version;
|
||||
internal set => SetAndNotify(ref _version, value);
|
||||
|
||||
@ -54,7 +54,7 @@ internal class PluginManagementService : IPluginManagementService
|
||||
// Remove the old directory if it exists
|
||||
if (Directory.Exists(pluginDirectory.FullName))
|
||||
pluginDirectory.DeleteRecursively();
|
||||
|
||||
|
||||
// Extract everything in the same archive directory to the unique plugin directory
|
||||
Utilities.CreateAccessibleDirectory(pluginDirectory.FullName);
|
||||
string metaDataDirectory = metaDataFileEntry.FullName.Replace(metaDataFileEntry.Name, "");
|
||||
@ -69,7 +69,7 @@ internal class PluginManagementService : IPluginManagementService
|
||||
zipArchiveEntry.ExtractToFile(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (createLockFile)
|
||||
File.Create(Path.Combine(pluginDirectory.FullName, "artemis.lock")).Close();
|
||||
}
|
||||
@ -137,26 +137,12 @@ internal class PluginManagementService : IPluginManagementService
|
||||
_logger.Debug("Copying missing built-in plugin {builtInPluginInfo}", builtInPluginInfo);
|
||||
CopyBuiltInPlugin(archive, preferred);
|
||||
}
|
||||
else
|
||||
else if (metaDataFileEntry.LastWriteTime > File.GetLastWriteTime(metadataFile))
|
||||
{
|
||||
PluginInfo pluginInfo;
|
||||
try
|
||||
{
|
||||
// Compare versions, copy if the same when debugging
|
||||
pluginInfo = CoreJson.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile))!;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisPluginException($"Failed read plugin metadata needed to install built-in plugin: {e.Message}", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (builtInPluginInfo.Version > pluginInfo.Version)
|
||||
{
|
||||
_logger.Debug("Copying updated built-in plugin from {pluginInfo} to {builtInPluginInfo}", pluginInfo, builtInPluginInfo);
|
||||
CopyBuiltInPlugin(archive, preferred);
|
||||
}
|
||||
_logger.Debug("Copying updated built-in plugin {builtInPluginInfo}", builtInPluginInfo);
|
||||
CopyBuiltInPlugin(archive, preferred);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@ -89,7 +89,7 @@ public class UpdateService : IUpdateService
|
||||
}
|
||||
}
|
||||
|
||||
// if (updated)
|
||||
if (updated)
|
||||
_updateNotificationProvider.Value.ShowInstalledNotification(currentVersion);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user