From df7d41fc37521ecfe039e9661cf288c933cb2bdc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 11 Dec 2016 21:03:57 -0500 Subject: move interfaces into root (#185) --- src/StardewModdingAPI/IReflectionHelper.cs | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/StardewModdingAPI/IReflectionHelper.cs (limited to 'src/StardewModdingAPI/IReflectionHelper.cs') diff --git a/src/StardewModdingAPI/IReflectionHelper.cs b/src/StardewModdingAPI/IReflectionHelper.cs new file mode 100644 index 00000000..5d747eda --- /dev/null +++ b/src/StardewModdingAPI/IReflectionHelper.cs @@ -0,0 +1,53 @@ +using System; + +namespace StardewModdingAPI +{ + /// Simplifies access to private game code. + public interface IReflectionHelper + { + /********* + ** Public methods + *********/ + /// Get a private instance field. + /// The field type. + /// The object which has the field. + /// The field name. + /// Whether to throw an exception if the private field is not found. + IPrivateField GetPrivateField(object obj, string name, bool required = true); + + /// Get a private static field. + /// The field type. + /// The type which has the field. + /// The field name. + /// Whether to throw an exception if the private field is not found. + IPrivateField GetPrivateField(Type type, string name, bool required = true); + + /// Get the value of a private instance field. + /// The field type. + /// The object which has the field. + /// The field name. + /// Whether to throw an exception if the private field is not found. + /// This is a shortcut for followed by . + TValue GetPrivateValue(object obj, string name, bool required = true); + + /// Get the value of a private static field. + /// The field type. + /// The type which has the field. + /// The field name. + /// Whether to throw an exception if the private field is not found. + /// This is a shortcut for followed by . + TValue GetPrivateValue(Type type, string name, bool required = true); + + /// Get a private instance method. + /// The object which has the method. + /// The field name. + /// Whether to throw an exception if the private field is not found. + IPrivateMethod GetPrivateMethod(object obj, string name, bool required = true); + + /// Get a private static method. + /// The type which has the method. + /// The field name. + /// Whether to throw an exception if the private field is not found. + IPrivateMethod GetPrivateMethod(Type type, string name, bool required = true); + } +} -- cgit