Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBeekman committed Jul 22, 2024
2 parents 0e911d6 + a45d98c commit a793a08
Show file tree
Hide file tree
Showing 58 changed files with 1,467 additions and 327 deletions.
16 changes: 15 additions & 1 deletion src/Artemis.Core/Plugins/PluginInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ internal PluginInfo()
[JsonInclude]
public Version? Api { get; internal init; } = new(1, 0, 0);

/// <summary>
/// Gets the minimum version of Artemis required by this plugin
/// </summary>
public Version? MinimumVersion { get; internal init; } = new(1, 0, 0);

/// <summary>
/// Gets the plugin this info is associated with
/// </summary>
Expand All @@ -132,7 +137,7 @@ internal PluginInfo()
/// 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;
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && Api != null && Api.Major >= Constants.PluginApiVersion && MatchesMinimumVersion();

/// <inheritdoc />
[JsonIgnore]
Expand All @@ -156,4 +161,13 @@ public override string ToString()
{
return $"{Name} v{Version} - {Guid}";
}

private bool MatchesMinimumVersion()
{
if (Constants.CurrentVersion == "local")
return true;

Version currentVersion = new(Constants.CurrentVersion);
return currentVersion >= MinimumVersion;
}
}
6 changes: 6 additions & 0 deletions src/Artemis.Storage/ArtemisDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasConversion(
v => JsonSerializer.Serialize(v, JsonSerializerOptions),
v => JsonSerializer.Deserialize<Dictionary<string, JsonNode>>(v, JsonSerializerOptions) ?? new Dictionary<string, JsonNode>());

modelBuilder.Entity<EntryEntity>()
.Property(e => e.Categories)
.HasConversion(
v => JsonSerializer.Serialize(v, JsonSerializerOptions),
v => JsonSerializer.Deserialize<List<EntryCategoryEntity>>(v, JsonSerializerOptions) ?? new List<EntryCategoryEntity>());

modelBuilder.Entity<ProfileContainerEntity>()
.Property(e => e.ProfileConfiguration)
Expand Down
15 changes: 12 additions & 3 deletions src/Artemis.Storage/Entities/Workshop/EntryEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ public class EntryEntity
public int EntryType { get; set; }

public string Author { get; set; } = string.Empty;
public bool IsOfficial { get; set; }
public string Name { get; set; } = string.Empty;

public string Summary { get; set; } = string.Empty;
public long Downloads { get; set; }
public DateTimeOffset CreatedAt { get; set; }
public long? LatestReleaseId { get; set; }

public long ReleaseId { get; set; }
public string ReleaseVersion { get; set; } = string.Empty;
public DateTimeOffset InstalledAt { get; set; }

public bool AutoUpdate { get; set; }

public Dictionary<string, JsonNode>? Metadata { get; set; }
}
public List<EntryCategoryEntity>? Categories { get; set; }
}

public record EntryCategoryEntity(string Name, string Icon);
Loading

0 comments on commit a793a08

Please sign in to comment.