19 lines
592 B
C#
19 lines
592 B
C#
using System.Reflection;
|
|
using SessionZero.SzfLib.Objects;
|
|
|
|
namespace SessionZero.SzfLib.Helpers;
|
|
|
|
public static class SzfHelper
|
|
{
|
|
public static Type? FindSzfObjectTypeByAttributeType(string szfType)
|
|
{
|
|
var obj = Assembly
|
|
.GetExecutingAssembly()
|
|
.GetTypes()
|
|
.FirstOrDefault(t => t.GetCustomAttribute(typeof(SzfObjectAttribute)) is not null && t.GetCustomAttribute<SzfObjectAttribute>()?.TypeIdentifier == szfType);
|
|
|
|
if (obj is null) return null;
|
|
|
|
return obj.IsAbstract || obj.IsInterface ? null : obj;
|
|
}
|
|
} |