diff options
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs')
-rw-r--r-- | src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs index e5bf47f6..648d6742 100644 --- a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs @@ -107,122 +107,6 @@ namespace StardewModdingAPI.Framework.ModHelpers ); } -#if !STARDEW_VALLEY_1_3 - /**** - ** Obsolete - ****/ - /// <summary>Get a private instance field.</summary> - /// <typeparam name="TValue">The field type.</typeparam> - /// <param name="obj">The object which has the field.</param> - /// <param name="name">The field name.</param> - /// <param name="required">Whether to throw an exception if the private field is not found.</param> - /// <returns>Returns the field wrapper, or <c>null</c> if the field doesn't exist and <paramref name="required"/> is <c>false</c>.</returns> - [Obsolete] - public IPrivateField<TValue> GetPrivateField<TValue>(object obj, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - return (IPrivateField<TValue>)this.GetField<TValue>(obj, name, required); - } - - /// <summary>Get a private static field.</summary> - /// <typeparam name="TValue">The field type.</typeparam> - /// <param name="type">The type which has the field.</param> - /// <param name="name">The field name.</param> - /// <param name="required">Whether to throw an exception if the private field is not found.</param> - [Obsolete] - public IPrivateField<TValue> GetPrivateField<TValue>(Type type, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - return (IPrivateField<TValue>)this.GetField<TValue>(type, name, required); - } - - /// <summary>Get a private instance property.</summary> - /// <typeparam name="TValue">The property type.</typeparam> - /// <param name="obj">The object which has the property.</param> - /// <param name="name">The property name.</param> - /// <param name="required">Whether to throw an exception if the private property is not found.</param> - [Obsolete] - public IPrivateProperty<TValue> GetPrivateProperty<TValue>(object obj, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - return (IPrivateProperty<TValue>)this.GetProperty<TValue>(obj, name, required); - } - - /// <summary>Get a private static property.</summary> - /// <typeparam name="TValue">The property type.</typeparam> - /// <param name="type">The type which has the property.</param> - /// <param name="name">The property name.</param> - /// <param name="required">Whether to throw an exception if the private property is not found.</param> - [Obsolete] - public IPrivateProperty<TValue> GetPrivateProperty<TValue>(Type type, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - return (IPrivateProperty<TValue>)this.GetProperty<TValue>(type, name, required); - } - - /// <summary>Get the value of a private instance field.</summary> - /// <typeparam name="TValue">The field type.</typeparam> - /// <param name="obj">The object which has the field.</param> - /// <param name="name">The field name.</param> - /// <param name="required">Whether to throw an exception if the private field is not found.</param> - /// <returns>Returns the field value, or the default value for <typeparamref name="TValue"/> if the field wasn't found and <paramref name="required"/> is false.</returns> - /// <remarks> - /// This is a shortcut for <see cref="GetPrivateField{TValue}(object,string,bool)"/> followed by <see cref="IPrivateField{TValue}.GetValue"/>. - /// When <paramref name="required" /> is false, this will return the default value if reflection fails. If you need to check whether the field exists, use <see cref="GetPrivateField{TValue}(object,string,bool)" /> instead. - /// </remarks> - [Obsolete] - public TValue GetPrivateValue<TValue>(object obj, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - IPrivateField<TValue> field = (IPrivateField<TValue>)this.GetField<TValue>(obj, name, required); - return field != null - ? field.GetValue() - : default(TValue); - } - - /// <summary>Get the value of a private static field.</summary> - /// <typeparam name="TValue">The field type.</typeparam> - /// <param name="type">The type which has the field.</param> - /// <param name="name">The field name.</param> - /// <param name="required">Whether to throw an exception if the private field is not found.</param> - /// <returns>Returns the field value, or the default value for <typeparamref name="TValue"/> if the field wasn't found and <paramref name="required"/> is false.</returns> - /// <remarks> - /// This is a shortcut for <see cref="GetPrivateField{TValue}(Type,string,bool)"/> followed by <see cref="IPrivateField{TValue}.GetValue"/>. - /// When <paramref name="required" /> is false, this will return the default value if reflection fails. If you need to check whether the field exists, use <see cref="GetPrivateField{TValue}(Type,string,bool)" /> instead. - /// </remarks> - [Obsolete] - public TValue GetPrivateValue<TValue>(Type type, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - IPrivateField<TValue> field = (IPrivateField<TValue>)this.GetField<TValue>(type, name, required); - return field != null - ? field.GetValue() - : default(TValue); - } - - /// <summary>Get a private instance method.</summary> - /// <param name="obj">The object which has the method.</param> - /// <param name="name">The field name.</param> - /// <param name="required">Whether to throw an exception if the private field is not found.</param> - [Obsolete] - public IPrivateMethod GetPrivateMethod(object obj, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - return (IPrivateMethod)this.GetMethod(obj, name, required); - } - - /// <summary>Get a private static method.</summary> - /// <param name="type">The type which has the method.</param> - /// <param name="name">The field name.</param> - /// <param name="required">Whether to throw an exception if the private field is not found.</param> - [Obsolete] - public IPrivateMethod GetPrivateMethod(Type type, string name, bool required = true) - { - this.DeprecationManager.Warn($"{nameof(IReflectionHelper)}.GetPrivate*", "2.3", DeprecationLevel.Notice); - return (IPrivateMethod)this.GetMethod(type, name, required); - } -#endif - /********* ** Private methods |