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>
|
/// </summary>
|
||||||
public static readonly PluginInfo CorePluginInfo = new()
|
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>
|
/// <summary>
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
|
|||||||
private Plugin _plugin = null!;
|
private Plugin _plugin = null!;
|
||||||
private Uri? _repository;
|
private Uri? _repository;
|
||||||
private bool _requiresAdmin;
|
private bool _requiresAdmin;
|
||||||
private Version _version = null!;
|
private string _version = null!;
|
||||||
private Uri? _website;
|
private Uri? _website;
|
||||||
|
|
||||||
internal PluginInfo()
|
internal PluginInfo()
|
||||||
@ -107,7 +107,7 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
|
|||||||
/// The version of the plugin
|
/// The version of the plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty(Required = Required.Always)]
|
[JsonProperty(Required = Required.Always)]
|
||||||
public Version Version
|
public string Version
|
||||||
{
|
{
|
||||||
get => _version;
|
get => _version;
|
||||||
internal set => SetAndNotify(ref _version, value);
|
internal set => SetAndNotify(ref _version, value);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
// Remove the old directory if it exists
|
// Remove the old directory if it exists
|
||||||
if (Directory.Exists(pluginDirectory.FullName))
|
if (Directory.Exists(pluginDirectory.FullName))
|
||||||
pluginDirectory.DeleteRecursively();
|
pluginDirectory.DeleteRecursively();
|
||||||
|
|
||||||
// Extract everything in the same archive directory to the unique plugin directory
|
// Extract everything in the same archive directory to the unique plugin directory
|
||||||
Utilities.CreateAccessibleDirectory(pluginDirectory.FullName);
|
Utilities.CreateAccessibleDirectory(pluginDirectory.FullName);
|
||||||
string metaDataDirectory = metaDataFileEntry.FullName.Replace(metaDataFileEntry.Name, "");
|
string metaDataDirectory = metaDataFileEntry.FullName.Replace(metaDataFileEntry.Name, "");
|
||||||
@ -69,7 +69,7 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
zipArchiveEntry.ExtractToFile(target);
|
zipArchiveEntry.ExtractToFile(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createLockFile)
|
if (createLockFile)
|
||||||
File.Create(Path.Combine(pluginDirectory.FullName, "artemis.lock")).Close();
|
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);
|
_logger.Debug("Copying missing built-in plugin {builtInPluginInfo}", builtInPluginInfo);
|
||||||
CopyBuiltInPlugin(archive, preferred);
|
CopyBuiltInPlugin(archive, preferred);
|
||||||
}
|
}
|
||||||
else
|
else if (metaDataFileEntry.LastWriteTime > File.GetLastWriteTime(metadataFile))
|
||||||
{
|
{
|
||||||
PluginInfo pluginInfo;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Compare versions, copy if the same when debugging
|
_logger.Debug("Copying updated built-in plugin {builtInPluginInfo}", builtInPluginInfo);
|
||||||
pluginInfo = CoreJson.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile))!;
|
CopyBuiltInPlugin(archive, preferred);
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class UpdateService : IUpdateService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (updated)
|
if (updated)
|
||||||
_updateNotificationProvider.Value.ShowInstalledNotification(currentVersion);
|
_updateNotificationProvider.Value.ShowInstalledNotification(currentVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user