Skip to content

Commit

Permalink
add minstudioversion for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Nov 20, 2024
1 parent 0c5ddbb commit f485a87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/OneWare.Core/Data/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ namespace OneWare.Core.Data;

public static class Global
{
public static string VersionCode => Assembly.GetEntryAssembly()!.GetName().Version?.ToString() ?? "";
public static Version Version => Assembly.GetEntryAssembly()!.GetName().Version!;

public static string VersionCode => Version.ToString() ?? "";
}
2 changes: 2 additions & 0 deletions src/OneWare.Essentials/PackageManager/PackageVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
public class PackageVersion
{
public string? Version { get; init; }

public string? MinStudioVersion { get; init; }

public PackageTarget[]? Targets { get; init; }

Expand Down
12 changes: 8 additions & 4 deletions src/OneWare.PackageManager/ViewModels/PackageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System.Reflection;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
Expand Down Expand Up @@ -114,16 +115,19 @@ public AsyncRelayCommand? MainButtonCommand
public AsyncRelayCommand InstallCommand { get; }

public AsyncRelayCommand UpdateCommand { get; }

private void InitPackage()
{
Links.Clear();
if (PackageModel.Package.Links != null)
Links.AddRange(PackageModel.Package.Links.Select(x => new LinkModel(x.Name ?? "Link", x.Url ?? "")));

PackageVersionModels.Clear();
if(PackageModel.Package.Versions != null)
PackageVersionModels.AddRange(PackageModel.Package.Versions.Select(x => new PackageVersionModel(x)));
if (PackageModel.Package.Versions != null)
PackageVersionModels.AddRange(PackageModel.Package.Versions
.Where(x => x.MinStudioVersion == null || Version.TryParse(x.MinStudioVersion, out var minVersion)
&& Assembly.GetEntryAssembly()!.GetName().Version > minVersion)
.Select(x => new PackageVersionModel(x)));
SelectedVersionModel = PackageVersionModels.LastOrDefault();
_resolveTabsStarted = false;
_resolveImageStarted = false;
Expand Down

0 comments on commit f485a87

Please sign in to comment.