1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Core - Embed PluginApiVersion into the assembly metadata

This commit is contained in:
Diogo Trindade 2022-09-30 22:16:02 +01:00 committed by RobertBeekman
parent 22268fc945
commit 3f1eaeda29
2 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,11 @@
<PluginApiVersion>1</PluginApiVersion>
</PropertyGroup>
<ItemGroup>
<!--Used to embed the above PluginApiVersion property into the assembly as metadata-->
<AssemblyMetadata Include="PluginApiVersion" Value="$(PluginApiVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Artemis.Storage\Artemis.Storage.csproj"/>
<ProjectReference Condition="'$(BuildingNuget)' == 'True'" Update="..\Artemis.Storage\Artemis.Storage.csproj" PrivateAssets="All"/>

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using Artemis.Core.JsonConverters;
using Artemis.Core.Services;
@ -61,7 +62,8 @@ public static class Constants
/// <summary>
/// The current API version for plugins
/// </summary>
public static readonly int PluginApiVersion = CoreAssembly.GetName().Version.Major;
public static readonly int PluginApiVersion = int.Parse(CoreAssembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(a => a.Key == "PluginApiVersion").Value);
/// <summary>
/// The plugin info used by core components of Artemis