From 773f2c72f193c87797769b7120c471ecd39f2ec5 Mon Sep 17 00:00:00 2001 From: Thomas Edward Kingstone Date: Tue, 2 Apr 2024 09:08:48 +0100 Subject: [PATCH 1/2] fixed doc compliance, and a bit of code compliance (extension methods etc.) --- UI_Engine/Compute/Constructor.cs | 6 +++--- UI_Engine/Compute/ConstructorText.cs | 8 ++++---- UI_Engine/Compute/SaveSettings.cs | 2 +- UI_Engine/Create/ParamInfo.cs | 16 ++++++++-------- UI_Engine/Query/AreMatching.cs | 4 ++-- UI_Engine/Query/Settings.cs | 12 ++++++------ 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/UI_Engine/Compute/Constructor.cs b/UI_Engine/Compute/Constructor.cs index c175bdc..b7090d7 100644 --- a/UI_Engine/Compute/Constructor.cs +++ b/UI_Engine/Compute/Constructor.cs @@ -36,9 +36,9 @@ public static partial class Compute /**** Public Methods ****/ /*************************************/ - [Input("type", "The type of object to create a constructor for")] - [Input("parameters", "The properties that should be used as parameters for the constructor")] - [Output("constructor", "The compiled constructor")] + [Input("type", "The type of object to create a constructor for.")] + [Input("parameters", "The properties that should be used as parameters for the constructor.")] + [Output("constructor", "The compiled constructor.")] public static Func Constructor(Type type, List parameters) { ParameterExpression lambdaInput = Expression.Parameter(typeof(object[]), "x"); diff --git a/UI_Engine/Compute/ConstructorText.cs b/UI_Engine/Compute/ConstructorText.cs index 58e9042..6a9dc32 100644 --- a/UI_Engine/Compute/ConstructorText.cs +++ b/UI_Engine/Compute/ConstructorText.cs @@ -37,10 +37,10 @@ public static partial class Compute /**** Public Methods ****/ /*************************************/ - [Input("type", "The type of object to create a constructor for")] - [Input("maxParams", "The maximum number of parameters to include in the text")] - [Input("maxChars", "The maximum number of characters for the output text")] - [Output("text", "The text corresponding to the description of the constructor generated for that type")] + [Input("type", "The type of object to create a constructor for.")] + [Input("maxParams", "The maximum number of parameters to include in the text.")] + [Input("maxChars", "The maximum number of characters for the output text.")] + [Output("text", "The text corresponding to the description of the constructor generated for that type.")] public static string ConstructorText(this Type type, int maxParams = 5, int maxChars = 40) { string text = type.Namespace + "." + type.Name + "." + type.Name + "() {"; diff --git a/UI_Engine/Compute/SaveSettings.cs b/UI_Engine/Compute/SaveSettings.cs index 7af8cd1..b17538a 100644 --- a/UI_Engine/Compute/SaveSettings.cs +++ b/UI_Engine/Compute/SaveSettings.cs @@ -40,7 +40,7 @@ public static partial class Compute /**** Public Methods ****/ /*************************************/ - [Description(@"Saves the settings for a toolkit into C:/ProgramData/BHoM/Settings. If Any previoulsy saved settings for that toolkit will be overwritten")] + [Description(@"Saves the settings for a toolkit into C:/ProgramData/BHoM/Settings. If Any previoulsy saved settings for that toolkit will be overwritten.")] [Input("settings", "Settings for a toolkit that need to be saved permanently.")] [Output("success", "Returns true if the settings were saved successfully.")] public static bool SaveSettings(ISettings settings) diff --git a/UI_Engine/Create/ParamInfo.cs b/UI_Engine/Create/ParamInfo.cs index 4c495e0..eb76479 100644 --- a/UI_Engine/Create/ParamInfo.cs +++ b/UI_Engine/Create/ParamInfo.cs @@ -34,10 +34,10 @@ public static partial class Create /**** Public Methods ****/ /*************************************/ - [Input("name", "The name of the parameter")] - [Input("type", "The framework type of the parameter, e.g. BH.oM.Base.BHoMObject")] - [Input("kind", "Whether the parameter is an input of an output. Input is the default value")] - [Output("parameter", "The bhom parameter used in the bhom abstract syntax")] + [Input("name", "The name of the parameter.")] + [Input("type", "The framework type of the parameter, e.g. BH.oM.Base.BHoMObject.")] + [Input("kind", "Whether the parameter is an input of an output. Input is the default value.")] + [Output("parameter", "The bhom parameter used in the bhom abstract syntax.")] public static ParamInfo ParamInfo(string name, Type type = null, ParamKind kind = ParamKind.Input) { if (type == null) @@ -53,8 +53,8 @@ public static ParamInfo ParamInfo(string name, Type type = null, ParamKind kind /*************************************/ - [Input("property", "The system property to convert to bhom")] - [Output("parameter", "The bhom parameter used in the bhom abstract syntax")] + [Input("property", "The system property to convert to bhom.")] + [Output("parameter", "The bhom parameter used in the bhom abstract syntax.")] public static ParamInfo ParamInfo(this PropertyInfo property, object instance = null) { ParamInfo info = new ParamInfo @@ -78,8 +78,8 @@ public static ParamInfo ParamInfo(this PropertyInfo property, object instance = /*************************************/ - [Input("property", "The system property to convert to bhom")] - [Output("parameter", "The bhom parameter used in the bhom abstract syntax")] + [Input("parameter", "The system parameter to convert to bhom.")] + [Output("parameter", "The bhom parameter used in the bhom abstract syntax.")] public static ParamInfo ParamInfo(this ParameterInfo parameter, string description = "") { Type paramType = parameter.ParameterType; diff --git a/UI_Engine/Query/AreMatching.cs b/UI_Engine/Query/AreMatching.cs index 435fb12..358320f 100644 --- a/UI_Engine/Query/AreMatching.cs +++ b/UI_Engine/Query/AreMatching.cs @@ -37,7 +37,7 @@ public static partial class Query /**** Public Methods ****/ /*************************************/ - public static bool AreMatching(List newList, List oldList) + public static bool AreMatching(this List newList, List oldList) { if (newList.Count != oldList.Count) return false; @@ -48,7 +48,7 @@ public static bool AreMatching(List newList, List oldList) /*************************************/ - public static bool AreMatching(List props, List oldList) + public static bool AreMatching(this List props, List oldList) { return oldList.All(x => props.Exists(p => p.Name == x.Name && p.PropertyType == x.DataType)); } diff --git a/UI_Engine/Query/Settings.cs b/UI_Engine/Query/Settings.cs index 9a019f2..6a4b716 100644 --- a/UI_Engine/Query/Settings.cs +++ b/UI_Engine/Query/Settings.cs @@ -40,9 +40,9 @@ public static partial class Query /**** Public Methods ****/ /*************************************/ - [Description(@"Extract settings of a given type from C:/ProgramData/BHoM/Settings")] - [Input("type", "Object type of the settings you want to recover")] - [Output("settings", @"Settings recovered from the corresponding file in C:/ProgramData/BHoM/Settings")] + [Description(@"Extract settings of a given type from C:/ProgramData/BHoM/Settings.")] + [Input("type", "Object type of the settings you want to recover.")] + [Output("settings", @"Settings recovered from the corresponding file in C:/ProgramData/BHoM/Settings.")] public static ISettings Settings(Type type) { if (type == null) @@ -65,9 +65,9 @@ public static ISettings Settings(Type type) /*************************************/ - [Description(@"Extract settings for a given toolkit from C:/ProgramData/BHoM/Settings")] - [Input("toolkitName", "Toolkit you want to recover the settings for")] - [Output("settings", @"Settings recovered from the corresponding file in C:/ProgramData/BHoM/Settings")] + [Description(@"Extract settings for a given toolkit from C:/ProgramData/BHoM/Settings.")] + [Input("toolkitName", "Toolkit you want to recover the settings for.")] + [Output("settings", @"Settings recovered from the corresponding file in C:/ProgramData/BHoM/Settings.")] public static ISettings Settings(string toolkitName) { // Make sure the file exists From 1fb141620d99ef5b413134d295a7962e97507d4e Mon Sep 17 00:00:00 2001 From: Thomas Edward Kingstone Date: Tue, 2 Apr 2024 09:43:52 +0100 Subject: [PATCH 2/2] fix code compliance --- UI_Engine/Query/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI_Engine/Query/Settings.cs b/UI_Engine/Query/Settings.cs index 6a4b716..824225d 100644 --- a/UI_Engine/Query/Settings.cs +++ b/UI_Engine/Query/Settings.cs @@ -43,7 +43,7 @@ public static partial class Query [Description(@"Extract settings of a given type from C:/ProgramData/BHoM/Settings.")] [Input("type", "Object type of the settings you want to recover.")] [Output("settings", @"Settings recovered from the corresponding file in C:/ProgramData/BHoM/Settings.")] - public static ISettings Settings(Type type) + public static ISettings Settings(this Type type) { if (type == null) {