diff --git a/IPA.Loader/Utilities/ReflectionUtil.cs b/IPA.Loader/Utilities/ReflectionUtil.cs
index e5b0650e..21badc6a 100644
--- a/IPA.Loader/Utilities/ReflectionUtil.cs
+++ b/IPA.Loader/Utilities/ReflectionUtil.cs
@@ -28,7 +28,7 @@ namespace IPA.Utilities
/// the object instance
/// the field to set
/// the value to set it to
- /// the object type the field belongs to
+ /// the object the field belongs to
/// thrown when is not a member of
/// thrown when isn't assignable as
public static void SetPrivateField(this object obj, string fieldName, object value, Type targetType)
@@ -54,12 +54,12 @@ namespace IPA.Utilities
}
///
- /// Gets the value of a (potentially) private field. specifies the the field belongs to
+ /// Gets the value of a (potentially) private field. specifies the the field belongs to.
///
/// the type of the field (result casted)
/// the object instance to pull from
/// the name of the field to read
- /// the object type the field belongs to
+ /// the object the field belongs to
/// the value of the field
/// thrown when is not a member of
/// thrown when isn't assignable as
@@ -82,12 +82,26 @@ namespace IPA.Utilities
public static void SetPrivateProperty(this object obj, string propertyName, object value)
{
Type targetType = obj.GetType();
+ obj.SetPrivateProperty(propertyName, value, targetType);
+ }
+
+ ///
+ /// Sets a (potentially) private property on the target object.
+ ///
+ /// the target object instance
+ /// the name of the property
+ /// the value to set it to
+ /// the object the property belongs to
+ /// thrown when is not a member of
+ /// thrown when isn't assignable as
+ public static void SetPrivateProperty(this object obj, string propertyName, object value, Type targetType)
+ {
var prop = targetType
.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
if (prop == null)
throw new InvalidOperationException($"{propertyName} is not a member of {targetType.Name}");
prop.SetValue(obj, value, null);
- }
+ }
///
/// Invokes a (potentially) private method.