This exception will be thrown when a ReflectionHelpers-method tries to access a member which is not present. We added this exception to replace ArgumentException, which is very generic.
This is the base exception of all custom exceptions which get thrown while using reflection. All reflection based custom exceptions should inherit from this class.
Completely redesigned the ReflectionHelpers-class. Methods are no longer using Harmony, this because while using Harmony we had no control over when an exception is thrown, and could not communicate to the user what went wrong. All method are now using reflection directly.
Added _fieldFlags and _propertFlags.
These variables hold the BindingFlags which are always used when looking for a field or property
Added GetPrivateFieldValue().
This method returns a value of a given private field.
Added SetPrivateFieldValue().
This method sets the value of a given private field to a given value.
Added GetPropertyValue()
This method returns the value of a given property, if the property is able to return a value.
Added SetPropertyValue()
This method sets a give property to a given value, if the property is able to be changed.
Added GetFieldInfo().
This method is used by both GetPrivateFieldValue() and SetPrivateFieldValue() to get the given field.
Added GetPropertyMethod().
This method is used by both GetPropertyValue and SetPropertyValue to get the appropriate get or set-method.
Added internal partial class ReflectionHelpersTests.
This class is divided over 2 files: ReflectionHelpersTests (internal).cs and ReflectionHelpersTests (external).cs.
ReflectionHelpersTests (internal).cs will hold the testing methods which will test the ReflectionHelpers-methods while using internally created test classes.
ReflectionHelpersTests (external).cs will hold the testing methods which will test the ReflectionHelpers-methods while using external Voxel Tycoon classes.
Added test-methods for GetPrivateFieldValue().
Added test-methods for SetPrivateFieldValue() (For both classes and structs).
Addes test-methods for GetPropertyValue().
Added tes-methods for SetPropertyValue() (For both classes and structs).
A couple of tests were failing, we decided to ignore the case and added an explanation what we think went wrong. It seems to be a very rare case and therefor we've decided to ignore the case.
The specific test is still there, it is just not executed (SetPropertyValue_EnsureNoBleeding_WhenGetAndSet()).
This exception will be thrown when a method returns a value which is not of the expected Type. This exception is ment to replace the ArgumentException, which is very generic.
According to #28 the name of this class was up for change. Since everything in this class was going to be replaced anyway, we removed this class and created ReflectionHelpers.
According to #28 the name of this class was up for change. Since everything in this class was going to be replaced anyway, we removed this class and created ReflectionHelpersTests.
MemberNotFoundException (new)
(MemberNotFoundException.cs)
MemberNotFoundException
-class.This exception will be thrown when a
ReflectionHelpers
-method tries to access a member which is not present. We added this exception to replaceArgumentException
, which is very generic.ReflectionException (new)
(ReflectionException.cs)
ReflectionException
-classThis is the base exception of all custom exceptions which get thrown while using reflection. All reflection based custom exceptions should inherit from this class.
ReflectionHelpers (new)
(ReflectionHelpers.cs)
This class replaces
VTOLReflectionHelpers
.Completely redesigned the
ReflectionHelpers
-class. Methods are no longer using Harmony, this because while using Harmony we had no control over when an exception is thrown, and could not communicate to the user what went wrong. All method are now using reflection directly.Added
_fieldFlags
and_propertFlags
.These variables hold the
BindingFlags
which are always used when looking for a field or propertyAdded
GetPrivateFieldValue()
.This method returns a value of a given private field.
Added
SetPrivateFieldValue()
.This method sets the value of a given private field to a given value.
Added
GetPropertyValue()
This method returns the value of a given property, if the property is able to return a value.
Added
SetPropertyValue()
This method sets a give property to a given value, if the property is able to be changed.
Added
GetFieldInfo()
.This method is used by both
GetPrivateFieldValue()
andSetPrivateFieldValue()
to get the given field.Added
GetPropertyMethod()
.This method is used by both
GetPropertyValue
andSetPropertyValue
to get the appropriateget
orset
-method.RelfectionHelpersTests (new)
(ReflectionHelpersTests (internal).cs) (ReflectionHelpersTests (external).cs)
This class replaces
VTOLReflectionHelpersTests
.internal partial class ReflectionHelpersTests
.This class is divided over 2 files: ReflectionHelpersTests (internal).cs and ReflectionHelpersTests (external).cs.
ReflectionHelpersTests (internal).cs will hold the testing methods which will test the
ReflectionHelpers
-methods while using internally created test classes.ReflectionHelpersTests (external).cs will hold the testing methods which will test the
ReflectionHelpers
-methods while using external Voxel Tycoon classes.GetPrivateFieldValue()
.SetPrivateFieldValue()
(For both classes and structs).GetPropertyValue()
.SetPropertyValue()
(For both classes and structs).A couple of tests were failing, we decided to ignore the case and added an explanation what we think went wrong. It seems to be a very rare case and therefor we've decided to ignore the case.
The specific test is still there, it is just not executed (
SetPropertyValue_EnsureNoBleeding_WhenGetAndSet()
).RequireLazyManagerAttribute (new)
(RequireLazyManagerAttribute.cs)
TypeMismatchException (new)
(TypeMismatchException.cs)
TypeMismatchException
-class.This exception will be thrown when a method returns a value which is not of the expected
Type
. This exception is ment to replace theArgumentException
, which is very generic.VTOLReflectionHelpers (removed)
(VTOLReflectionHelpers.cs)
According to #28 the name of this class was up for change. Since everything in this class was going to be replaced anyway, we removed this class and created
ReflectionHelpers
.VTOLReflectionHelpersTests (removed)
(VTOLReflectionHelpersTests.cs)
According to #28 the name of this class was up for change. Since everything in this class was going to be replaced anyway, we removed this class and created
ReflectionHelpersTests
.Files
(.gitignore) (stryker-config.json) (Voxel Tycoon Open Library.csproj) (Voxel Tycoon Open Library.sln)
Added ReflectionHelpersTests (internal).cs and ReflectionHelpersTests (external).cs,
These files will both hold a part of the
partial ReflectionHelpersTests
-class.