From a6fad7efb87563de11f0041f2809f1ffa258bc3b Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Thu, 4 Mar 2021 20:18:37 -0500 Subject: [PATCH 01/28] Added handling for predefined lists for code generation of TextField --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index fe413366..0c2bca98 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -132,10 +132,14 @@ private string ConvertJToken(JToken jToken) _ => value?.ToString()?.Replace(',', '.'), // Replace decimal commas. }; case JArray jArray: - return $"new[] {{ {string.Join(", ", jArray.Select(ConvertJToken))} }}"; + var arrLines = jArray.Select(ConvertJToken).ToArray(); + if(arrLines.Length > 1) + return $"new[] \n\t\t\t{{ {string.Join(", ", arrLines)} \n\t\t\t}}"; + + return $"new[] {{ {string.Join(", ", arrLines)} }}"; case JObject jObject: // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. - return T["\"FIX ME! Couldn't determine the actual type to instantiate.\" {0}", jObject.ToString()]; + return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; default: throw new NotSupportedException($"Settings values of type {jToken.GetType()} are not supported."); } From a546a6d5a236b465ae2302799ef49bc0b9d14151 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Thu, 4 Mar 2021 20:28:36 -0500 Subject: [PATCH 02/28] Reverted some string formatting --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 0c2bca98..64222129 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -132,11 +132,7 @@ private string ConvertJToken(JToken jToken) _ => value?.ToString()?.Replace(',', '.'), // Replace decimal commas. }; case JArray jArray: - var arrLines = jArray.Select(ConvertJToken).ToArray(); - if(arrLines.Length > 1) - return $"new[] \n\t\t\t{{ {string.Join(", ", arrLines)} \n\t\t\t}}"; - - return $"new[] {{ {string.Join(", ", arrLines)} }}"; + return $"new[] \n\t\t\t{{ {string.Join(", ", jArray.Select(ConvertJToken))} \n\t\t\t}}"; case JObject jObject: // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; From 344841832f1ff21137b6d927be35dd544f0c5f96 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Sat, 6 Mar 2021 07:57:16 -0500 Subject: [PATCH 03/28] Check for name and value properties --- .../CodeGeneration/CodeGenerationDisplayDriver.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 64222129..7f407db2 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -131,11 +131,21 @@ private string ConvertJToken(JToken jToken) string _ => $"\"{value}\"", _ => value?.ToString()?.Replace(',', '.'), // Replace decimal commas. }; + case JArray jArray: return $"new[] \n\t\t\t{{ {string.Join(", ", jArray.Select(ConvertJToken))} \n\t\t\t}}"; + case JObject jObject: - // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. - return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; + if(jObject["name"] != null && jObject["value"] != null) + { + return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; + } + else + { + // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. + return T["\"FIX ME! Couldn't determine the actual type to instantiate.\" {0}", jObject.ToString()]; + } + default: throw new NotSupportedException($"Settings values of type {jToken.GetType()} are not supported."); } From 8b1ac541be32f1bb4298a093bf8b8a20848f0008 Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Mon, 8 Mar 2021 09:29:45 -0500 Subject: [PATCH 04/28] Spacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 7f407db2..fbc7c5a9 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -136,7 +136,8 @@ private string ConvertJToken(JToken jToken) return $"new[] \n\t\t\t{{ {string.Join(", ", jArray.Select(ConvertJToken))} \n\t\t\t}}"; case JObject jObject: - if(jObject["name"] != null && jObject["value"] != null) + if (jObject["name"] != null && jObject["value"] != null) + { return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; } From b9790352cf016afbd3ebcfc212e4c6422c4d0621 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Thu, 8 Apr 2021 16:27:06 -0400 Subject: [PATCH 05/28] Updated formatting --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index fbc7c5a9..6289f765 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,11 +133,13 @@ private string ConvertJToken(JToken jToken) }; case JArray jArray: - return $"new[] \n\t\t\t{{ {string.Join(", ", jArray.Select(ConvertJToken))} \n\t\t\t}}"; + var token = string.Join(", ", jArray.Select(ConvertJToken)); + var format = token.Contains("ListValueOption") ? "\n\t\t\t" : ""; + + return $"new[] {format}{{ {string.Join(", ", token)} {format}}}"; case JObject jObject: if (jObject["name"] != null && jObject["value"] != null) - { return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; } From 52c07ff2afa42e3f286923aec234e9563e420974 Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Fri, 9 Apr 2021 16:16:55 -0400 Subject: [PATCH 06/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 6289f765..d8ee046a 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -134,7 +134,8 @@ private string ConvertJToken(JToken jToken) case JArray jArray: var token = string.Join(", ", jArray.Select(ConvertJToken)); - var format = token.Contains("ListValueOption") ? "\n\t\t\t" : ""; + var format = token.Contains("ListValueOption", StringComparison.Ordinal) ? "\n\t\t\t" : string.Empty; + return $"new[] {format}{{ {string.Join(", ", token)} {format}}}"; From aeae0f12ac7094f1335e61d5e16caf8d0ef03db8 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Mon, 19 Apr 2021 15:40:34 -0400 Subject: [PATCH 07/28] Replaced tabs with spaces --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 6289f765..8372ea8f 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -134,14 +134,14 @@ private string ConvertJToken(JToken jToken) case JArray jArray: var token = string.Join(", ", jArray.Select(ConvertJToken)); - var format = token.Contains("ListValueOption") ? "\n\t\t\t" : ""; + var format = token.Contains("ListValueOption") ? "\n " : ""; return $"new[] {format}{{ {string.Join(", ", token)} {format}}}"; case JObject jObject: if (jObject["name"] != null && jObject["value"] != null) { - return $"\n\t\t\t\tnew ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; + return $"\n new ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; } else { From 8da317eeeb9c88c6ec6c0173ec02a5288f0bec6e Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Tue, 20 Apr 2021 12:17:19 -0400 Subject: [PATCH 08/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 8372ea8f..feb35a67 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -134,7 +134,8 @@ private string ConvertJToken(JToken jToken) case JArray jArray: var token = string.Join(", ", jArray.Select(ConvertJToken)); - var format = token.Contains("ListValueOption") ? "\n " : ""; + var format = token.Contains("ListValueOption") ? "\n " : string.Empty; + return $"new[] {format}{{ {string.Join(", ", token)} {format}}}"; From b8c7555be8e1ed552825fc962519ba36bb47044b Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Sat, 5 Mar 2022 12:07:02 -0500 Subject: [PATCH 09/28] Fixed up formatting --- .../CodeGenerationDisplayDriver.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 1b314a16..0c853fb2 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -119,7 +119,7 @@ private void GenerateCodeForPartsWithFields( } } - private string ConvertJToken(JToken jToken) + private string ConvertJToken(JToken jToken, int indentationDepth) { switch (jToken) { @@ -133,16 +133,18 @@ private string ConvertJToken(JToken jToken) }; case JArray jArray: - var token = string.Join(", ", jArray.Select(ConvertJToken)); - var format = token.Contains("ListValueOption") ? "\n " : string.Empty; - + var token = string.Join(", ", jArray.Select(a => ConvertJToken(a, indentationDepth * 2))); + var format = token.Contains("ListValueOption", StringComparison.InvariantCulture) + ? $"\n{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth * 1.5)))}" + : string.Empty; return $"new[] {format}{{ {string.Join(", ", token)} {format}}}"; case JObject jObject: + var indentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); if (jObject["name"] != null && jObject["value"] != null) { - return $"\n new ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; + return $"\n{indentation}new ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; } else { @@ -161,8 +163,10 @@ private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, var filteredSettings = ((IEnumerable>)settings) .Where(setting => setting.Key != typeof(T).Name); + foreach (var setting in filteredSettings) { + var properties = setting.Value.Where(property => property is JProperty).Cast().ToArray(); if (properties.Length == 0) continue; @@ -175,7 +179,8 @@ private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, for (int i = 0; i < properties.Length; i++) { var property = properties[i]; - var propertyValue = ConvertJToken(property.Value); + + var propertyValue = ConvertJToken(property.Value, indentationDepth); if (propertyValue == null) { From af195a0f752aed1317f6305ef3405dfee7434527 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Sat, 5 Mar 2022 12:09:26 -0500 Subject: [PATCH 10/28] Removed NuGet.config --- NuGet.config | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 NuGet.config diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index 4e034695..00000000 --- a/NuGet.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 480e11167526d9167ec939f3167c28d820ce5adc Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Mon, 7 Mar 2022 16:46:51 -0500 Subject: [PATCH 11/28] Update to use ContainsOrdinalIgnoreCase --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 0c853fb2..c655050e 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -134,7 +134,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) case JArray jArray: var token = string.Join(", ", jArray.Select(a => ConvertJToken(a, indentationDepth * 2))); - var format = token.Contains("ListValueOption", StringComparison.InvariantCulture) + var format = token.ContainsOrdinalIgnoreCase("ListValueOption") ? $"\n{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth * 1.5)))}" : string.Empty; @@ -166,7 +166,6 @@ private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, foreach (var setting in filteredSettings) { - var properties = setting.Value.Where(property => property is JProperty).Cast().ToArray(); if (properties.Length == 0) continue; From a3b98fc00a2c8cfe9da0293b168e085d7a44733d Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Mon, 7 Mar 2022 19:03:47 -0500 Subject: [PATCH 12/28] Rename parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index c655050e..52a388ec 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,7 +133,8 @@ private string ConvertJToken(JToken jToken, int indentationDepth) }; case JArray jArray: - var token = string.Join(", ", jArray.Select(a => ConvertJToken(a, indentationDepth * 2))); + var token = string.Join(", ", jArray.Select(item => ConvertJToken(item, indentationDepth * 2))); + var format = token.ContainsOrdinalIgnoreCase("ListValueOption") ? $"\n{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth * 1.5)))}" : string.Empty; From 926bcc655d6cc81ecf039802bc854c26c55b7592 Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Mon, 7 Mar 2022 19:04:19 -0500 Subject: [PATCH 13/28] Update error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 52a388ec..7002ef22 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -147,11 +147,9 @@ private string ConvertJToken(JToken jToken, int indentationDepth) { return $"\n{indentation}new ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; } - else - { - // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. - return T["\"FIX ME! Couldn't determine the actual type to instantiate.\" {0}", jObject.ToString()]; - } + + // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. + return T["\"FIX ME! Couldn't determine the actual type to instantiate.\" {0}", jObject.ToString()]; default: throw new NotSupportedException($"Settings values of type {jToken.GetType()} are not supported."); From 6cc87f46d5aa2017221c7372ce4f1942ae83086a Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Mon, 7 Mar 2022 19:44:01 -0500 Subject: [PATCH 14/28] Made array init format properties on separate lines --- .../CodeGenerationDisplayDriver.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 7002ef22..4c946367 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,19 +133,28 @@ private string ConvertJToken(JToken jToken, int indentationDepth) }; case JArray jArray: - var token = string.Join(", ", jArray.Select(item => ConvertJToken(item, indentationDepth * 2))); + var token = string.Join(string.Empty, jArray.Select(item => ConvertJToken(item, indentationDepth + 8))); var format = token.ContainsOrdinalIgnoreCase("ListValueOption") - ? $"\n{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth * 1.5)))}" + ? $"{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4)))}" : string.Empty; - return $"new[] {format}{{ {string.Join(", ", token)} {format}}}"; + return $"new[]\n {format}{{ {token} {format}}}"; case JObject jObject: - var indentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); + var braceIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); + var propertyIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4))); if (jObject["name"] != null && jObject["value"] != null) { - return $"\n{indentation}new ListValueOption {{ Name = \"{jObject["name"]}\", Value = \"{jObject["value"]}\" }}"; + var codeBuilder = new StringBuilder(); + codeBuilder.AppendLine(); + codeBuilder.AppendLine($"{braceIndentation}new ListValueOption"); + codeBuilder.AppendLine($"{braceIndentation}{{"); + codeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); + codeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\" }},"); + codeBuilder.AppendLine($"{braceIndentation}}},"); + + return codeBuilder.ToString(); } // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. From af907dd36091ddcbf88c48aa1e3b7d538747504d Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Mon, 7 Mar 2022 19:50:21 -0500 Subject: [PATCH 15/28] Fix formatting --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 4c946367..0efeba8c 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -139,7 +139,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) ? $"{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4)))}" : string.Empty; - return $"new[]\n {format}{{ {token} {format}}}"; + return $"new[]\n{format}{{\n{token}{format}}}"; case JObject jObject: var braceIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); @@ -147,7 +147,6 @@ private string ConvertJToken(JToken jToken, int indentationDepth) if (jObject["name"] != null && jObject["value"] != null) { var codeBuilder = new StringBuilder(); - codeBuilder.AppendLine(); codeBuilder.AppendLine($"{braceIndentation}new ListValueOption"); codeBuilder.AppendLine($"{braceIndentation}{{"); codeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); From 49cff4cdb6fed1fb61e7408e6f86dfc8c60776cc Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Tue, 8 Mar 2022 08:40:53 -0500 Subject: [PATCH 16/28] Remove extra closing brace --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 0efeba8c..0f915c41 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -150,7 +150,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) codeBuilder.AppendLine($"{braceIndentation}new ListValueOption"); codeBuilder.AppendLine($"{braceIndentation}{{"); codeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); - codeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\" }},"); + codeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\","); codeBuilder.AppendLine($"{braceIndentation}}},"); return codeBuilder.ToString(); From 5103adaaaab0c880730b01f4c5f713a9eb1482c8 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Tue, 8 Mar 2022 10:53:31 -0500 Subject: [PATCH 17/28] Updated formatting and removed @ symbol --- .../CodeGenerationDisplayDriver.cs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 0f915c41..f0d5f9f2 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -135,25 +135,22 @@ private string ConvertJToken(JToken jToken, int indentationDepth) case JArray jArray: var token = string.Join(string.Empty, jArray.Select(item => ConvertJToken(item, indentationDepth + 8))); - var format = token.ContainsOrdinalIgnoreCase("ListValueOption") - ? $"{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4)))}" - : string.Empty; + var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4)))}"; return $"new[]\n{format}{{\n{token}{format}}}"; - case JObject jObject: var braceIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); var propertyIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4))); if (jObject["name"] != null && jObject["value"] != null) { - var codeBuilder = new StringBuilder(); - codeBuilder.AppendLine($"{braceIndentation}new ListValueOption"); - codeBuilder.AppendLine($"{braceIndentation}{{"); - codeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); - codeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\","); - codeBuilder.AppendLine($"{braceIndentation}}},"); - - return codeBuilder.ToString(); + var objectCodeBuilder = new StringBuilder(); + objectCodeBuilder.AppendLine($"{braceIndentation}new ListValueOption"); + objectCodeBuilder.AppendLine($"{braceIndentation}{{"); + objectCodeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); + objectCodeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\","); + objectCodeBuilder.AppendLine($"{braceIndentation}}},"); + + return objectCodeBuilder.ToString(); } // Using a quoted string so it doesn't mess up the syntax highlighting of the rest of the code. @@ -192,7 +189,8 @@ private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, { propertyValue = "\"\""; } - else if (propertyValue.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase)) + else if (propertyValue.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase) + && !setting.Key.ContainsOrdinalIgnoreCase("TextFieldPredefinedListEditorSettings")) { propertyValue = "@" + propertyValue; } From 372c1f217c045c355d5b4535a175b5f310b83ec7 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Tue, 8 Mar 2022 12:17:04 -0500 Subject: [PATCH 18/28] Fix string array formatting --- .../CodeGenerationDisplayDriver.cs | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index f0d5f9f2..213ff93a 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,14 +133,37 @@ private string ConvertJToken(JToken jToken, int indentationDepth) }; case JArray jArray: - var token = string.Join(string.Empty, jArray.Select(item => ConvertJToken(item, indentationDepth + 8))); + var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; + + var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); + + // If the items are formatted (for ListValueOption) the don't inject line-by-line formatting + if(items.Any(item => item.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase))) + { + var token = string.Join("", items); + return $"new[]\n{format}{{\n{token}{format}}}"; + } + // Otherwise, make sure that we have proper formatting for string arrays + else + { + var stringArrayCodeBuilder = new StringBuilder("new[]"); + stringArrayCodeBuilder.AppendLine(); + stringArrayCodeBuilder.AppendLine($"{format}{{"); + + var itemFormat = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 8))}"; - var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4)))}"; + foreach (var item in items) + { + stringArrayCodeBuilder.AppendLine($"{itemFormat}{item},"); + } + stringArrayCodeBuilder.Append($"{format}}}"); + + return stringArrayCodeBuilder.ToString(); + } - return $"new[]\n{format}{{\n{token}{format}}}"; case JObject jObject: var braceIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); - var propertyIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", (int)(indentationDepth + 4))); + var propertyIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4)); if (jObject["name"] != null && jObject["value"] != null) { var objectCodeBuilder = new StringBuilder(); @@ -148,7 +171,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) objectCodeBuilder.AppendLine($"{braceIndentation}{{"); objectCodeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); objectCodeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\","); - objectCodeBuilder.AppendLine($"{braceIndentation}}},"); + objectCodeBuilder.AppendLine($"{braceIndentation}}}"); return objectCodeBuilder.ToString(); } @@ -189,11 +212,6 @@ private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, { propertyValue = "\"\""; } - else if (propertyValue.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase) - && !setting.Key.ContainsOrdinalIgnoreCase("TextFieldPredefinedListEditorSettings")) - { - propertyValue = "@" + propertyValue; - } codeBuilder.AppendLine($"{indentation} {property.Name} = {propertyValue},"); } From fd3a3071c592125b139bc9ea994fb3886486166f Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Tue, 8 Mar 2022 13:21:55 -0500 Subject: [PATCH 19/28] Add missing comma --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 213ff93a..c23e1b99 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -171,7 +171,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) objectCodeBuilder.AppendLine($"{braceIndentation}{{"); objectCodeBuilder.AppendLine($"{propertyIndentation}Name = \"{jObject["name"]}\","); objectCodeBuilder.AppendLine($"{propertyIndentation}Value = \"{jObject["value"]}\","); - objectCodeBuilder.AppendLine($"{braceIndentation}}}"); + objectCodeBuilder.AppendLine($"{braceIndentation}}},"); return objectCodeBuilder.ToString(); } From 74e462e7a7fabfbdac6265235e120ca7c65b048f Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Tue, 8 Mar 2022 14:31:05 -0500 Subject: [PATCH 20/28] Update for code analyzer fixes --- .../CodeGenerationDisplayDriver.cs | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index c23e1b99..a608e801 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -134,33 +134,32 @@ private string ConvertJToken(JToken jToken, int indentationDepth) case JArray jArray: var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; - + var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); - + // If the items are formatted (for ListValueOption) the don't inject line-by-line formatting - if(items.Any(item => item.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase))) + if (items.Any(item => item.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase))) { - var token = string.Join("", items); + var token = string.Join(string.Empty, items); return $"new[]\n{format}{{\n{token}{format}}}"; } - // Otherwise, make sure that we have proper formatting for string arrays - else - { - var stringArrayCodeBuilder = new StringBuilder("new[]"); - stringArrayCodeBuilder.AppendLine(); - stringArrayCodeBuilder.AppendLine($"{format}{{"); - var itemFormat = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 8))}"; + // Otherwise, make sure that we have proper formatting for string arrays + var stringArrayCodeBuilder = new StringBuilder("new[]"); + stringArrayCodeBuilder.AppendLine(); + stringArrayCodeBuilder.AppendLine($"{format}{{"); - foreach (var item in items) - { - stringArrayCodeBuilder.AppendLine($"{itemFormat}{item},"); - } - stringArrayCodeBuilder.Append($"{format}}}"); + var itemFormat = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 8))}"; - return stringArrayCodeBuilder.ToString(); + foreach (var item in items) + { + stringArrayCodeBuilder.AppendLine($"{itemFormat}{item},"); } + stringArrayCodeBuilder.Append($"{format}}}"); + + return stringArrayCodeBuilder.ToString(); + case JObject jObject: var braceIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); var propertyIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4)); @@ -208,10 +207,7 @@ private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, var propertyValue = ConvertJToken(property.Value, indentationDepth); - if (propertyValue == null) - { - propertyValue = "\"\""; - } + propertyValue ??= "\"\""; codeBuilder.AppendLine($"{indentation} {property.Name} = {propertyValue},"); } From c985db244cc356e4a790a0d47de8d383139d39ae Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Tue, 8 Mar 2022 16:03:50 -0500 Subject: [PATCH 21/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index a608e801..09c9e56d 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -138,7 +138,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); // If the items are formatted (for ListValueOption) the don't inject line-by-line formatting - if (items.Any(item => item.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase))) + if (items.Any(item => item.ContainsOrdinalIgnoreCase(Environment.NewLine))) { var token = string.Join(string.Empty, items); return $"new[]\n{format}{{\n{token}{format}}}"; From b62ee3a52ec464fd095ebec3a7c6e39d5213988f Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Tue, 8 Mar 2022 16:03:59 -0500 Subject: [PATCH 22/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 09c9e56d..abef5677 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -144,7 +144,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) return $"new[]\n{format}{{\n{token}{format}}}"; } - // Otherwise, make sure that we have proper formatting for string arrays + // Otherwise, make sure that we have proper formatting for string arrays. var stringArrayCodeBuilder = new StringBuilder("new[]"); stringArrayCodeBuilder.AppendLine(); stringArrayCodeBuilder.AppendLine($"{format}{{"); From 24d2e11bd0f8033632db5a2133585bc8552ef2b0 Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Tue, 8 Mar 2022 16:04:09 -0500 Subject: [PATCH 23/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index abef5677..dd5abb31 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,7 +133,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) }; case JArray jArray: - var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; + var indentation = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); From 1016044f220cfb095bdffbd759c8efa2bc809921 Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Tue, 8 Mar 2022 16:04:19 -0500 Subject: [PATCH 24/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index dd5abb31..2f519337 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -149,7 +149,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) stringArrayCodeBuilder.AppendLine(); stringArrayCodeBuilder.AppendLine($"{format}{{"); - var itemFormat = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 8))}"; + var itemFormat = new string(' ', indentationDepth + 8); foreach (var item in items) { From 78f895d02c0978fb55c5686ce4b81285a2fd8b3e Mon Sep 17 00:00:00 2001 From: Mike Paterson Date: Tue, 8 Mar 2022 16:04:32 -0500 Subject: [PATCH 25/28] Update Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 2f519337..c20dd0ee 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -137,7 +137,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); - // If the items are formatted (for ListValueOption) the don't inject line-by-line formatting + // If the items are formatted (for ListValueOption) then don't inject line-by-line formatting. if (items.Any(item => item.ContainsOrdinalIgnoreCase(Environment.NewLine))) { var token = string.Join(string.Empty, items); From 9b6be420db6ccb902073b03c21636e9f978b0765 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Wed, 9 Mar 2022 11:42:38 -0500 Subject: [PATCH 26/28] Renamed `format` to `indentation` --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index a608e801..5c108b54 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,7 +133,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) }; case JArray jArray: - var format = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; + var indentation = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); @@ -141,13 +141,13 @@ private string ConvertJToken(JToken jToken, int indentationDepth) if (items.Any(item => item.Contains(Environment.NewLine, StringComparison.OrdinalIgnoreCase))) { var token = string.Join(string.Empty, items); - return $"new[]\n{format}{{\n{token}{format}}}"; + return $"new[]\n{indentation}{{\n{token}{indentation}}}"; } // Otherwise, make sure that we have proper formatting for string arrays var stringArrayCodeBuilder = new StringBuilder("new[]"); stringArrayCodeBuilder.AppendLine(); - stringArrayCodeBuilder.AppendLine($"{format}{{"); + stringArrayCodeBuilder.AppendLine($"{indentation}{{"); var itemFormat = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 8))}"; @@ -156,7 +156,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) stringArrayCodeBuilder.AppendLine($"{itemFormat}{item},"); } - stringArrayCodeBuilder.Append($"{format}}}"); + stringArrayCodeBuilder.Append($"{indentation}}}"); return stringArrayCodeBuilder.ToString(); From 70942a4e0a3324f3245d8ca289df8db5be832d62 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Wed, 9 Mar 2022 11:44:42 -0500 Subject: [PATCH 27/28] Rename variable --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index ac7c0b8b..437b6862 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -149,11 +149,11 @@ private string ConvertJToken(JToken jToken, int indentationDepth) stringArrayCodeBuilder.AppendLine(); stringArrayCodeBuilder.AppendLine($"{indentation}{{"); - var itemFormat = new string(' ', indentationDepth + 8); + var itemIndentation = new string(' ', indentationDepth + 8); foreach (var item in items) { - stringArrayCodeBuilder.AppendLine($"{itemFormat}{item},"); + stringArrayCodeBuilder.AppendLine($"{itemIndentation}{item},"); } stringArrayCodeBuilder.Append($"{indentation}}}"); From dd7160f34d7e4aea34cc680a191fc376a6ca4540 Mon Sep 17 00:00:00 2001 From: Michael Paterson Date: Wed, 9 Mar 2022 11:58:11 -0500 Subject: [PATCH 28/28] Converted string.Join to use string ctor --- Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs index 437b6862..a37fbf6f 100644 --- a/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs +++ b/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs @@ -133,7 +133,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) }; case JArray jArray: - var indentation = $"{string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4))}"; + var indentation = new string(' ', indentationDepth + 4); var items = jArray.Select(item => ConvertJToken(item, indentationDepth + 8)).ToList(); @@ -161,8 +161,8 @@ private string ConvertJToken(JToken jToken, int indentationDepth) return stringArrayCodeBuilder.ToString(); case JObject jObject: - var braceIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); - var propertyIndentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth + 4)); + var braceIndentation = new string(' ', indentationDepth); + var propertyIndentation = new string(' ', indentationDepth + 4); if (jObject["name"] != null && jObject["value"] != null) { var objectCodeBuilder = new StringBuilder(); @@ -185,7 +185,7 @@ private string ConvertJToken(JToken jToken, int indentationDepth) private void AddSettingsWithout(StringBuilder codeBuilder, JObject settings, int indentationDepth) { - var indentation = string.Join(string.Empty, Enumerable.Repeat(" ", indentationDepth)); + var indentation = new string(' ', indentationDepth); var filteredSettings = ((IEnumerable>)settings) .Where(setting => setting.Key != typeof(T).Name);