19 lines
618 B
C#
19 lines
618 B
C#
using System.Reflection;
|
|
using MycroForge.Core.Attributes;
|
|
|
|
namespace MycroForge.Core.Extensions;
|
|
|
|
public static class EnumExtensions
|
|
{
|
|
/// <summary>
|
|
/// A generic extension method that aids in reflecting
|
|
/// and retrieving any attribute that is applied to an `Enum`.
|
|
/// </summary>
|
|
public static string ToDockerPlatformString(this ProjectConfig.DbConfig.DbuPlatformOptions value)
|
|
{
|
|
return value.GetType()
|
|
.GetMember(value.ToString())
|
|
.FirstOrDefault()!
|
|
.GetCustomAttribute<DockerPlatformAttribute>()!.Platform;
|
|
}
|
|
} |