mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
Merge branch 'dev' into no-boxing
This commit is contained in:
2 files changed
+11
-13
No files matched your search
@@ -166,7 +166,7 @@ public abstract class ModdedOptionMemberAttribute(string? memberName, Type? hold
|
||||
{
|
||||
flags |= BindingFlags.Instance;
|
||||
|
||||
var canSearchPrivates = type.GetCustomAttribute<SearchPrivateAttribute>() != null;
|
||||
var canSearchPrivates = type.IsDefined<SearchPrivateAttribute>();
|
||||
|
||||
if (canSearchPrivates)
|
||||
flags |= BindingFlags.NonPublic;
|
||||
@@ -175,7 +175,7 @@ public abstract class ModdedOptionMemberAttribute(string? memberName, Type? hold
|
||||
|
||||
foreach (var method in type.GetMethods(getterFlags))
|
||||
{
|
||||
if (method.GetParameters().Length > 0 || (method.GetCustomAttribute<InstanceGetterAttribute>() == null && method.Name != "GetInstance"))
|
||||
if (method.GetParameters().Length > 0 || (method.IsDefined<InstanceGetterAttribute>() && method.Name != "GetInstance"))
|
||||
continue;
|
||||
|
||||
instanceGetter = method;
|
||||
@@ -186,7 +186,7 @@ public abstract class ModdedOptionMemberAttribute(string? memberName, Type? hold
|
||||
{
|
||||
foreach (var prop in type.GetProperties(getterFlags))
|
||||
{
|
||||
if (prop.GetCustomAttribute<InstanceGetterAttribute>() == null && prop.Name != "Instance")
|
||||
if (prop.IsDefined<InstanceGetterAttribute>() && prop.Name != "Instance")
|
||||
continue;
|
||||
|
||||
var getMethod = prop.GetGetMethod(canSearchPrivates);
|
||||
@@ -213,7 +213,7 @@ public abstract class ModdedOptionMemberAttribute(string? memberName, Type? hold
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (type.GetCustomAttribute<SearchPrivateAttribute>() != null)
|
||||
else if (type.IsDefined<SearchPrivateAttribute>())
|
||||
{
|
||||
flags |= BindingFlags.NonPublic;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public sealed class MiraPluginManager
|
||||
{
|
||||
foreach (var type in assembly.GetTypes())
|
||||
{
|
||||
if ((isMira && type.IsAbstract) || type.GetCustomAttribute<MiraIgnoreAttribute>() != null)
|
||||
if ((isMira && type.IsAbstract) || type.IsDefined<MiraIgnoreAttribute>())
|
||||
continue;
|
||||
|
||||
RegisterEvents(type);
|
||||
@@ -226,7 +226,7 @@ public sealed class MiraPluginManager
|
||||
|
||||
foreach (var property in type.GetProperties())
|
||||
{
|
||||
if (property.IsDefined<MiraIgnoreAttribute>(false))
|
||||
if (property.IsDefined<MiraIgnoreAttribute>())
|
||||
continue;
|
||||
|
||||
var getter = property.GetMethod;
|
||||
@@ -426,7 +426,7 @@ public sealed class MiraPluginManager
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.GetCustomAttribute<LocalSettingsButtonAttribute>() != null &&
|
||||
if (property.IsDefined<LocalSettingsButtonAttribute>() &&
|
||||
property.PropertyType.IsAssignableTo(typeof(LocalSettingsButton)))
|
||||
{
|
||||
var button = property.GetValue(tabInstance) as LocalSettingsButton;
|
||||
@@ -453,15 +453,13 @@ public sealed class MiraPluginManager
|
||||
}
|
||||
|
||||
var attribute = property.GetCustomAttribute<LocalSettingAttribute>();
|
||||
if (attribute == null)
|
||||
if (attribute != null)
|
||||
{
|
||||
continue;
|
||||
attribute.CreateSetting(type, configEntry);
|
||||
}
|
||||
|
||||
attribute.CreateSetting(type, configEntry);
|
||||
}
|
||||
|
||||
foreach (var field in type.GetFields().Where(f => f.FieldType.IsAssignableTo(typeof(ConfigEntryBase)) && f.GetCustomAttribute<LocalSettingAttribute>() != null))
|
||||
foreach (var field in type.GetFields().Where(f => f.FieldType.IsAssignableTo(typeof(ConfigEntryBase)) && f.IsDefined<LocalSettingAttribute>()))
|
||||
{
|
||||
Error($"{field.Name} is a field, not a property. Use properties for local settings.");
|
||||
}
|
||||
@@ -480,7 +478,7 @@ public sealed class MiraPluginManager
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type.GetCustomAttribute<RegisterCustomKeybindsAttribute>() == null)
|
||||
if (type.IsDefined<RegisterCustomKeybindsAttribute>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user