diff --git a/Dalamud/Utility/Signatures/NullabilityUtil.cs b/Dalamud/Utility/Signatures/NullabilityUtil.cs index 83749c6ec..0a2fb7fc6 100755 --- a/Dalamud/Utility/Signatures/NullabilityUtil.cs +++ b/Dalamud/Utility/Signatures/NullabilityUtil.cs @@ -6,12 +6,30 @@ using System.Reflection; namespace Dalamud.Utility.Signatures { + /// + /// Class providing info about field, property or parameter nullability. + /// internal static class NullabilityUtil { + /// + /// Check if the provided property is nullable. + /// + /// The property to check. + /// Whether or not the property is nullable. internal static bool IsNullable(PropertyInfo property) => IsNullableHelper(property.PropertyType, property.DeclaringType, property.CustomAttributes); + /// + /// Check if the provided field is nullable. + /// + /// The field to check. + /// Whether or not the field is nullable. internal static bool IsNullable(FieldInfo field) => IsNullableHelper(field.FieldType, field.DeclaringType, field.CustomAttributes); + /// + /// Check if the provided parameter is nullable. + /// + /// The parameter to check. + /// Whether or not the parameter is nullable. internal static bool IsNullable(ParameterInfo parameter) => IsNullableHelper(parameter.ParameterType, parameter.Member, parameter.CustomAttributes); private static bool IsNullableHelper(Type memberType, MemberInfo? declaringType, IEnumerable customAttributes) diff --git a/Dalamud/Utility/Signatures/ScanType.cs b/Dalamud/Utility/Signatures/ScanType.cs index 5ede63ed7..58e861805 100755 --- a/Dalamud/Utility/Signatures/ScanType.cs +++ b/Dalamud/Utility/Signatures/ScanType.cs @@ -1,4 +1,6 @@ -namespace Dalamud.Utility.Signatures +using Dalamud.Game; + +namespace Dalamud.Utility.Signatures { /// /// The type of scan to perform with a signature. @@ -13,7 +15,7 @@ /// /// Scans the text section of the executable in order to find a data section - /// address. Uses + /// address. Uses . /// StaticAddress, } diff --git a/Dalamud/Utility/Signatures/SignatureAttribute.cs b/Dalamud/Utility/Signatures/SignatureAttribute.cs index ac6e6fbf8..aacdd3d52 100755 --- a/Dalamud/Utility/Signatures/SignatureAttribute.cs +++ b/Dalamud/Utility/Signatures/SignatureAttribute.cs @@ -61,7 +61,7 @@ namespace Dalamud.Utility.Signatures /// /// Initializes a new instance of the class. /// - /// signature to scan for, see + /// signature to scan for, see . public SignatureAttribute(string signature) { this.Signature = signature; diff --git a/Dalamud/Utility/Signatures/SignatureException.cs b/Dalamud/Utility/Signatures/SignatureException.cs index b8b2a12ba..6c3efd6dd 100755 --- a/Dalamud/Utility/Signatures/SignatureException.cs +++ b/Dalamud/Utility/Signatures/SignatureException.cs @@ -12,6 +12,8 @@ namespace Dalamud.Utility.Signatures /// /// Message. internal SignatureException(string message) - : base(message) { } + : base(message) + { + } } } diff --git a/Dalamud/Utility/Signatures/Wrappers/FieldInfoWrapper.cs b/Dalamud/Utility/Signatures/Wrappers/FieldInfoWrapper.cs index ed99d6b19..daad25bd7 100755 --- a/Dalamud/Utility/Signatures/Wrappers/FieldInfoWrapper.cs +++ b/Dalamud/Utility/Signatures/Wrappers/FieldInfoWrapper.cs @@ -3,26 +3,38 @@ using System.Reflection; namespace Dalamud.Utility.Signatures.Wrappers { + /// + /// Class providing information about a field. + /// internal sealed class FieldInfoWrapper : IFieldOrPropertyInfo { + /// + /// Initializes a new instance of the class. + /// + /// FieldInfo to populate from. public FieldInfoWrapper(FieldInfo info) { this.Info = info; } + /// public string Name => this.Info.Name; + /// public Type ActualType => this.Info.FieldType; + /// public bool IsNullable => NullabilityUtil.IsNullable(this.Info); private FieldInfo Info { get; } + /// public void SetValue(object? self, object? value) { this.Info.SetValue(self, value); } + /// public T? GetCustomAttribute() where T : Attribute { return this.Info.GetCustomAttribute(); diff --git a/Dalamud/Utility/Signatures/Wrappers/IFieldOrPropertyInfo.cs b/Dalamud/Utility/Signatures/Wrappers/IFieldOrPropertyInfo.cs index 60e4fbc24..0c54c80ab 100755 --- a/Dalamud/Utility/Signatures/Wrappers/IFieldOrPropertyInfo.cs +++ b/Dalamud/Utility/Signatures/Wrappers/IFieldOrPropertyInfo.cs @@ -2,16 +2,38 @@ using System; namespace Dalamud.Utility.Signatures.Wrappers { + /// + /// Interface providing information about a field or a property. + /// internal interface IFieldOrPropertyInfo { + /// + /// Gets the name of the field or property. + /// string Name { get; } + /// + /// Gets the actual type of the field or property. + /// Type ActualType { get; } + /// + /// Gets a value indicating whether or not the field or property is nullable. + /// bool IsNullable { get; } + /// + /// Set this field or property's value. + /// + /// The object instance. + /// The value to set. void SetValue(object? self, object? value); + /// + /// Get a custom attribute. + /// + /// The type of the attribute. + /// The attribute. T? GetCustomAttribute() where T : Attribute; } } diff --git a/Dalamud/Utility/Signatures/Wrappers/PropertyInfoWrapper.cs b/Dalamud/Utility/Signatures/Wrappers/PropertyInfoWrapper.cs index e90e3ae9f..8ee3a102d 100755 --- a/Dalamud/Utility/Signatures/Wrappers/PropertyInfoWrapper.cs +++ b/Dalamud/Utility/Signatures/Wrappers/PropertyInfoWrapper.cs @@ -3,6 +3,9 @@ using System.Reflection; namespace Dalamud.Utility.Signatures.Wrappers { + /// + /// Class providing information about a property. + /// internal sealed class PropertyInfoWrapper : IFieldOrPropertyInfo { /// @@ -14,19 +17,24 @@ namespace Dalamud.Utility.Signatures.Wrappers this.Info = info; } + /// public string Name => this.Info.Name; + /// public Type ActualType => this.Info.PropertyType; + /// public bool IsNullable => NullabilityUtil.IsNullable(this.Info); private PropertyInfo Info { get; } + /// public void SetValue(object? self, object? value) { this.Info.SetValue(self, value); } + /// public T? GetCustomAttribute() where T : Attribute { return this.Info.GetCustomAttribute(); diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index ca7a30a44..61795e5f5 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -335,7 +335,7 @@ namespace Dalamud.Utility if (exit) Environment.Exit(-1); } - + /// /// Transform byte count to human readable format. ///