Core - Remove API versioning, we have MinimumVersion to achieve the same thing

This commit is contained in:
Robert committed 2025-12-19 23:11:27 +01:00
1 parent e2cb73e327
commit 86f2426f37
184 files changed
+598 -523

No files matched your search

@@ -16,7 +16,7 @@ public abstract class LayerBrushProvider : PluginFeature
/// </summary>
protected LayerBrushProvider()
{
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
_layerBrushDescriptors = [];
LayerBrushDescriptors = new ReadOnlyCollection<LayerBrushDescriptor>(_layerBrushDescriptors);
Disabled += OnDisabled;
}
@@ -16,7 +16,7 @@ public abstract class LayerEffectProvider : PluginFeature
/// </summary>
protected LayerEffectProvider()
{
_layerEffectDescriptors = new List<LayerEffectDescriptor>();
_layerEffectDescriptors = [];
LayerEffectDescriptors = new ReadOnlyCollection<LayerEffectDescriptor>(_layerEffectDescriptors);
Disabled += OnDisabled;
}
@@ -15,7 +15,7 @@ namespace Artemis.Core.Modules;
public abstract class DataModel
{
private const StringComparison PathsStringComparison = StringComparison.OrdinalIgnoreCase;
private readonly List<DataModelPath> _activePaths = new();
private readonly List<DataModelPath> _activePaths = [];
private readonly HashSet<string> _activePathsHashSet = new(StringComparer.FromComparison(PathsStringComparison));
private readonly Dictionary<string, DynamicChild> _dynamicChildren = new();
+3 -3
View File
@@ -111,13 +111,13 @@ public abstract class Module<T> : Module where T : DataModel, new()
/// </summary>
public abstract class Module : PluginFeature
{
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new();
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = [];
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = [];
/// <summary>
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
/// </summary>
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new();
protected internal readonly List<PropertyInfo> HiddenPropertiesList = [];
/// <summary>
/// The base constructor of the <see cref="Module" /> class.
@@ -18,7 +18,7 @@ public abstract class NodeProvider : PluginFeature
/// </summary>
public NodeProvider()
{
_nodeDescriptors = new List<NodeData>();
_nodeDescriptors = [];
NodeDescriptors = new ReadOnlyCollection<NodeData>(_nodeDescriptors);
Disabled += OnDisabled;
}
+2 -2
View File
@@ -31,8 +31,8 @@ public class Plugin : CorePropertyChanged, IDisposable
Info.Plugin = this;
_loadedFromStorage = loadedFromStorage;
_features = new List<PluginFeatureInfo>();
_profilers = new List<Profiler>();
_features = [];
_profilers = [];
Features = new ReadOnlyCollection<PluginFeatureInfo>(_features);
Profilers = new ReadOnlyCollection<Profiler>(_profilers);
@@ -78,7 +78,7 @@ public class PluginFeatureInfo : IPrerequisitesSubject
public PluginFeature? Instance { get; internal set; }
/// <inheritdoc />
public List<PluginPrerequisite> Prerequisites { get; } = new();
public List<PluginPrerequisite> Prerequisites { get; } = [];
/// <inheritdoc />
public IEnumerable<PluginPrerequisite> PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
+11 -11
View File
@@ -109,13 +109,7 @@ public class PluginInfo : IPrerequisitesSubject
/// </summary>
[JsonInclude]
public PluginPlatform? Platforms { get; internal init; }
/// <summary>
/// Gets the API version the plugin was built for
/// </summary>
[JsonInclude]
public Version? Api { get; internal init; } = new(1, 0, 0);
/// <summary>
/// Gets the minimum version of Artemis required by this plugin
/// </summary>
@@ -125,27 +119,33 @@ public class PluginInfo : IPrerequisitesSubject
/// Gets the plugin this info is associated with
/// </summary>
[JsonIgnore]
public Plugin Plugin { get; internal set; } = null!;
public Plugin? Plugin { get; internal set; }
/// <summary>
/// Gets a string representing either a full path pointing to an svg or the markdown icon
/// </summary>
[JsonIgnore]
public string? ResolvedIcon => Icon == null ? null : Icon.Contains('.') ? Plugin.ResolveRelativePath(Icon) : Icon;
public string? ResolvedIcon => Icon == null ? null : Icon.Contains('.') ? Plugin?.ResolveRelativePath(Icon) : Icon;
/// <summary>
/// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version
/// </summary>
[JsonIgnore]
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && Api != null && Api.Major >= Constants.PluginApiVersion && MatchesMinimumVersion();
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && MatchesMinimumVersion();
/// <inheritdoc />
[JsonIgnore]
public List<PluginPrerequisite> Prerequisites { get; } = new();
public List<PluginPrerequisite> Prerequisites { get; } = [];
/// <inheritdoc />
[JsonIgnore]
public IEnumerable<PluginPrerequisite> PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
/// <summary>
/// Gets the exception thrown while loading
/// </summary>
[JsonIgnore]
public Exception? LoadException { get; internal set; }
[JsonIgnore]
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";