CAMERA V1

This commit is contained in:
2025-09-11 20:29:17 +08:00
parent c7165f0dc5
commit ccbe0f626f
135 changed files with 26211 additions and 182 deletions

View File

@@ -0,0 +1,24 @@
using System.ComponentModel;
using System.Reflection;
namespace FATrace.HKNetLib.Common
{
public static class EnumExtension
{
public static string GetDesc<T>(this T em) where T : Enum
{
Type type = em.GetType();
FieldInfo fd = type.GetField(em.ToString());
var num = Convert.ToInt32(em);
if (fd == null)
{
return $"{num}";
}
var firstAttr = fd.GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault();
if (firstAttr == null) return $"{num}";
return (firstAttr as DescriptionAttribute).Description;
}
}
}