From 15fcb6be6aee532aa792e86b7d0008a563d8301f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADcio=20Godoy?= Date: Sun, 10 Dec 2023 18:39:37 -0300 Subject: [PATCH] feat: support indentation on T4 templates --- .../CodeWriters/EnumExtensionsWriter.cs | 176 ++--- .../CodeWriters/EnumExtensionsWriter.tt | 120 ++-- .../CodeWriters/EnumFactoryWriter.cs | 484 ++++++------- .../CodeWriters/EnumFactoryWriter.tt | 636 +++++++++--------- .../CodeWriters/EnumValidationWriter.cs | 68 +- .../CodeWriters/EnumValidationWriter.tt | 66 +- src/EnumUtilities/Common/CodeWriterBase.cs | 113 +++- src/EnumUtilities/EnumUtilities.csproj | 2 + ...tionTests.Models.CategoriesExtensions.g.cs | 2 +- ...grationTests.Models.CategoriesFactory.g.cs | 2 +- ...tionTests.Models.CategoriesValidation.g.cs | 2 +- ...grationTests.Models.ColoursExtensions.g.cs | 2 +- ...ntegrationTests.Models.ColoursFactory.g.cs | 2 +- ...grationTests.Models.ColoursValidation.g.cs | 2 +- ...ionTests.Models.HumanStatesExtensions.g.cs | 2 +- ...rationTests.Models.HumanStatesFactory.g.cs | 2 +- ...ionTests.Models.HumanStatesValidation.g.cs | 2 +- ...nTests.Models.PaymentMethodExtensions.g.cs | 2 +- ...tionTests.Models.PaymentMethodFactory.g.cs | 2 +- ...nTests.Models.PaymentMethodValidation.g.cs | 2 +- ...rationTests.Models.WeekDaysExtensions.g.cs | 2 +- ...tegrationTests.Models.WeekDaysFactory.g.cs | 2 +- ...rationTests.Models.WeekDaysValidation.g.cs | 2 +- 23 files changed, 907 insertions(+), 788 deletions(-) diff --git a/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.cs b/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.cs index b469337..713c209 100644 --- a/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.cs +++ b/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.cs @@ -49,35 +49,36 @@ public override string TransformText() #line 18 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + PushIndent(); } #line default #line hidden - this.Write(" [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\r\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\""); + this.Write("[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\r\n[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\""); - #line 22 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 23 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CurrentAssemblyName.Name)); #line default #line hidden this.Write("\", \""); - #line 22 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 23 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Append($"{CurrentAssemblyName.Version}"))); #line default #line hidden - this.Write("\")]\r\n public static partial class "); + this.Write("\")]\r\npublic static partial class "); - #line 23 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 24 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("Extensions\r\n {\r\n"); + this.Write("Extensions\r\n{\r\n"); - #line 25 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 26 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * DEFAULT @@ -86,16 +87,16 @@ public override string TransformText() #line default #line hidden - this.Write(" /// Converts the value of this instance to its equivalent string representation.\r\n /// The string representation of the value of this instance.\r\n public static string ToStringFast(this "); + this.Write(" /// Converts the value of this instance to its equivalent string representation.\r\n /// The string representation of the value of this instance.\r\n public static string ToStringFast(this "); - #line 32 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 33 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 36 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 37 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" foreach (var curr in Model.UniqueValues) { @@ -103,60 +104,60 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 40 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 40 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => nameof("); - #line 40 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 40 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write("),\r\n"); - #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 42 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" _ => value.ToString()\r\n };\r\n }\r\n\r\n /// Returns a boolean telling whether the value of this instance exists in the enumeration.\r\n /// true if the value of this instance exists in the enumeration; false otherwise.\r\n public static bool IsDefined(this "); + this.Write(" _ => value.ToString()\r\n };\r\n }\r\n\r\n /// Returns a boolean telling whether the value of this instance exists in the enumeration.\r\n /// true if the value of this instance exists in the enumeration; false otherwise.\r\n public static bool IsDefined(this "); - #line 50 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 51 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return "); + this.Write(" value)\r\n {\r\n return "); - #line 52 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 53 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("Validation.IsDefined(value);\r\n }\r\n"); + this.Write("Validation.IsDefined(value);\r\n }\r\n"); - #line 54 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 55 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * ENUM MEMBER ATTRIBUTE @@ -167,16 +168,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static string ToEnumMemberValue(this "); + this.Write("\r\n public static string ToEnumMemberValue(this "); - #line 62 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 63 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 66 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 67 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" foreach (var curr in Model.UniqueValues) { @@ -184,41 +185,41 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 70 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 71 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 70 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 71 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => "); - #line 70 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 71 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.SerializationValue != null - ? Append($"\"{curr.SerializationValue}\"") - : Append($"nameof({Model.Name}.{curr.MemberName})"))); + ? Append($"\"{curr.SerializationValue}\"") + : Append($"nameof({Model.Name}.{curr.MemberName})"))); #line default #line hidden this.Write(",\r\n"); - #line 73 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 74 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" _ => value.ToString()\r\n };\r\n }\r\n"); + this.Write(" _ => value.ToString()\r\n };\r\n }\r\n"); - #line 79 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 80 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } @@ -226,7 +227,7 @@ public override string TransformText() #line default #line hidden - #line 82 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 83 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * DESCRIPTION ATTRIBUTE @@ -237,16 +238,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static string? GetDescription(this "); + this.Write("\r\n public static string? GetDescription(this "); - #line 90 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 91 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 94 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 95 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" foreach (var curr in Model.UniqueValues.Where(x => x.Description != null)) { @@ -254,39 +255,39 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 98 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 99 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 98 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 99 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => \""); - #line 98 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 99 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Description)); #line default #line hidden this.Write("\",\r\n"); - #line 99 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 100 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" _ => null\r\n };\r\n }\r\n"); + this.Write(" _ => null\r\n };\r\n }\r\n"); - #line 105 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 106 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } @@ -294,7 +295,7 @@ public override string TransformText() #line default #line hidden - #line 108 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 109 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * DISPLAY ATTRIBUTE @@ -305,16 +306,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static string GetDisplayShortName(this "); + this.Write("\r\n public static string GetDisplayShortName(this "); - #line 116 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 117 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 120 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 121 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" foreach (var curr in Model.UniqueValues.Where(x => x.Display?.ShortName != null)) { @@ -322,48 +323,48 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 124 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 125 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 124 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 125 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => "); - #line 124 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 125 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Display!.ResourceShortName != null - ? Append(curr.Display.ResourceShortName) - : Append($"\"{curr.Display.ShortName}\""))); + ? Append(curr.Display.ResourceShortName) + : Append($"\"{curr.Display.ShortName}\""))); #line default #line hidden this.Write(",\r\n"); - #line 127 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 128 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" _ => GetDisplayName(value)\r\n };\r\n }\r\n\r\n public static string GetDisplayName(this "); + this.Write(" _ => GetDisplayName(value)\r\n };\r\n }\r\n\r\n public static string GetDisplayName(this "); - #line 134 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 135 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 138 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 139 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" foreach (var curr in Model.UniqueValues) { @@ -371,23 +372,23 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 142 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 143 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 142 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 143 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => "); - #line 142 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 143 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Display?.ResourceName != null ? Append(curr.Display.ResourceName) : curr.Display?.Name != null @@ -398,16 +399,16 @@ public override string TransformText() #line hidden this.Write(",\r\n"); - #line 148 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 149 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" _ => value.ToString()\r\n };\r\n }\r\n"); + this.Write(" _ => value.ToString()\r\n };\r\n }\r\n"); - #line 154 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 155 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } @@ -415,7 +416,7 @@ public override string TransformText() #line default #line hidden - #line 157 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 158 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" if (Model.HasDisplayDescription) { @@ -423,16 +424,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static string? GetDescription(this "); + this.Write("\r\n public static string? GetDescription(this "); - #line 162 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 163 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 166 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 167 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" foreach (var curr in Model.UniqueValues.Where(x => x.Display?.Description != null)) { @@ -440,23 +441,23 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 170 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 171 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 170 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 171 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => "); - #line 170 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 171 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Display!.ResourceDescription != null ? Append(curr.Display.ResourceDescription) : Append($"\"{curr.Display.Description}\""))); @@ -465,35 +466,36 @@ public override string TransformText() #line hidden this.Write(",\r\n"); - #line 174 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 175 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" _ => null\r\n };\r\n }\r\n"); + this.Write(" _ => null\r\n };\r\n }\r\n"); - #line 180 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 181 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } #line default #line hidden - this.Write(" }\r\n"); + this.Write("}\r\n"); - #line 184 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 185 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" if (!string.IsNullOrEmpty(Model.Namespace)) { + PopIndent(); #line default #line hidden this.Write("}\r\n"); - #line 189 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 191 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" } @@ -503,7 +505,7 @@ public override string TransformText() return this.GenerationEnvironment.ToString(); } - #line 192 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" + #line 194 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumExtensionsWriter.tt" public EnumExtensionsWriter(StringBuilder builder) : base(builder) { diff --git a/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.tt b/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.tt index bc59f7f..f04c470 100644 --- a/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.tt +++ b/src/EnumUtilities/CodeWriters/EnumExtensionsWriter.tt @@ -16,41 +16,42 @@ using System; namespace <#= Model.Namespace #> { <# + PushIndent(); } #> - [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#= CurrentAssemblyName.Name #>", "<#= Append($"{CurrentAssemblyName.Version}") #>")] - public static partial class <#= Model.Name #>Extensions - { +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +[global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#= CurrentAssemblyName.Name #>", "<#= Append($"{CurrentAssemblyName.Version}") #>")] +public static partial class <#= Model.Name #>Extensions +{ <# /* ----------------------------------------------------------------------------------------------------------------- * DEFAULT * -------------------------------------------------------------------------------------------------------------- */ #> - /// Converts the value of this instance to its equivalent string representation. - /// The string representation of the value of this instance. - public static string ToStringFast(this <#= Model.Name #> value) + /// Converts the value of this instance to its equivalent string representation. + /// The string representation of the value of this instance. + public static string ToStringFast(this <#= Model.Name #> value) + { + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues) { #> - <#= Model.Name #>.<#= curr.MemberName #> => nameof(<#= Model.Name #>.<#= curr.MemberName #>), + <#= Model.Name #>.<#= curr.MemberName #> => nameof(<#= Model.Name #>.<#= curr.MemberName #>), <# } #> - _ => value.ToString() - }; - } + _ => value.ToString() + }; + } - /// Returns a boolean telling whether the value of this instance exists in the enumeration. - /// true if the value of this instance exists in the enumeration; false otherwise. - public static bool IsDefined(this <#= Model.Name #> value) - { - return <#= Model.Name #>Validation.IsDefined(value); - } + /// Returns a boolean telling whether the value of this instance exists in the enumeration. + /// true if the value of this instance exists in the enumeration; false otherwise. + public static bool IsDefined(this <#= Model.Name #> value) + { + return <#= Model.Name #>Validation.IsDefined(value); + } <# /* ----------------------------------------------------------------------------------------------------------------- * ENUM MEMBER ATTRIBUTE @@ -59,23 +60,23 @@ namespace <#= Model.Namespace #> { #> - public static string ToEnumMemberValue(this <#= Model.Name #> value) + public static string ToEnumMemberValue(this <#= Model.Name #> value) + { + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues) { #> - <#= Model.Name #>.<#= curr.MemberName #> => <#= curr.SerializationValue != null - ? Append($"\"{curr.SerializationValue}\"") - : Append($"nameof({Model.Name}.{curr.MemberName})") #>, + <#= Model.Name #>.<#= curr.MemberName #> => <#= curr.SerializationValue != null + ? Append($"\"{curr.SerializationValue}\"") + : Append($"nameof({Model.Name}.{curr.MemberName})") #>, <# } #> - _ => value.ToString() - }; - } + _ => value.ToString() + }; + } <# } #> @@ -87,21 +88,21 @@ namespace <#= Model.Namespace #> { #> - public static string? GetDescription(this <#= Model.Name #> value) + public static string? GetDescription(this <#= Model.Name #> value) + { + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues.Where(x => x.Description != null)) { #> - <#= Model.Name #>.<#= curr.MemberName #> => "<#= curr.Description #>", + <#= Model.Name #>.<#= curr.MemberName #> => "<#= curr.Description #>", <# } #> - _ => null - }; - } + _ => null + }; + } <# } #> @@ -113,33 +114,33 @@ namespace <#= Model.Namespace #> { #> - public static string GetDisplayShortName(this <#= Model.Name #> value) + public static string GetDisplayShortName(this <#= Model.Name #> value) + { + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues.Where(x => x.Display?.ShortName != null)) { #> - <#= Model.Name #>.<#= curr.MemberName #> => <#= curr.Display!.ResourceShortName != null - ? Append(curr.Display.ResourceShortName) - : Append($"\"{curr.Display.ShortName}\"") #>, + <#= Model.Name #>.<#= curr.MemberName #> => <#= curr.Display!.ResourceShortName != null + ? Append(curr.Display.ResourceShortName) + : Append($"\"{curr.Display.ShortName}\"") #>, <# } #> - _ => GetDisplayName(value) - }; - } + _ => GetDisplayName(value) + }; + } - public static string GetDisplayName(this <#= Model.Name #> value) + public static string GetDisplayName(this <#= Model.Name #> value) + { + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues) { #> - <#= Model.Name #>.<#= curr.MemberName #> => <#= + <#= Model.Name #>.<#= curr.MemberName #> => <#= curr.Display?.ResourceName != null ? Append(curr.Display.ResourceName) : curr.Display?.Name != null @@ -148,9 +149,9 @@ namespace <#= Model.Namespace #> <# } #> - _ => value.ToString() - }; - } + _ => value.ToString() + }; + } <# } #> @@ -159,31 +160,32 @@ namespace <#= Model.Namespace #> { #> - public static string? GetDescription(this <#= Model.Name #> value) + public static string? GetDescription(this <#= Model.Name #> value) + { + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues.Where(x => x.Display?.Description != null)) { #> - <#= Model.Name #>.<#= curr.MemberName #> => <#= + <#= Model.Name #>.<#= curr.MemberName #> => <#= curr.Display!.ResourceDescription != null ? Append(curr.Display.ResourceDescription) : Append($"\"{curr.Display.Description}\"") #>, <# } #> - _ => null - }; - } + _ => null + }; + } <# } #> - } +} <# if (!string.IsNullOrEmpty(Model.Namespace)) { + PopIndent(); #> } <# diff --git a/src/EnumUtilities/CodeWriters/EnumFactoryWriter.cs b/src/EnumUtilities/CodeWriters/EnumFactoryWriter.cs index 054ccfd..c26b775 100644 --- a/src/EnumUtilities/CodeWriters/EnumFactoryWriter.cs +++ b/src/EnumUtilities/CodeWriters/EnumFactoryWriter.cs @@ -49,35 +49,36 @@ public override string TransformText() #line 20 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + PushIndent(); } #line default #line hidden - this.Write(" [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\r\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\""); + this.Write("[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\r\n[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\""); - #line 24 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 25 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CurrentAssemblyName.Name)); #line default #line hidden this.Write("\", \""); - #line 24 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 25 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Append($"{CurrentAssemblyName.Version}"))); #line default #line hidden - this.Write("\")]\r\n public static partial class "); + this.Write("\")]\r\npublic static partial class "); - #line 25 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 26 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("Factory\r\n {\r\n"); + this.Write("Factory\r\n{\r\n"); - #line 27 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 28 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * DEFAULT @@ -86,37 +87,37 @@ public override string TransformText() #line default #line hidden - this.Write(" /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// When this method returns, result contains an object of type "); + this.Write(" /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// When this method returns, result contains an object of type "); - #line 39 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 40 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); + this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); - #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 42 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write(". Note that this value need not be a member of the "); - #line 41 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 42 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n /// is not a value.\r\n public static bool TryParse(\r\n [NotNullWhen(true)] string? name,\r\n StringComparison comparisonType,\r\n out "); + this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n /// is not a value.\r\n public static bool TryParse(\r\n [NotNullWhen(true)] string? name,\r\n StringComparison comparisonType,\r\n out "); - #line 48 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 49 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (name)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (name)\r\n {\r\n"); - #line 52 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 53 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values) { @@ -124,88 +125,88 @@ public override string TransformText() #line default #line hidden - this.Write(" case { } s when s.Equals(nameof("); + this.Write(" case { } s when s.Equals(nameof("); - #line 56 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 57 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 56 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 57 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write("), comparisonType):\r\n result = "); + this.Write("), comparisonType):\r\n result = "); - #line 57 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 58 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 57 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 58 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 59 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 60 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" case { } s when TryParseNumeric(s, comparisonType, out "); + this.Write(" case { } s when TryParseNumeric(s, comparisonType, out "); - #line 62 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 63 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.UnderlyingType)); #line default #line hidden - this.Write(" val):\r\n result = ("); + this.Write(" val):\r\n result = ("); - #line 63 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 64 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(")val;\r\n return true;\r\n default:\r\n return Enum.TryParse(name, out result);\r\n }\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// When this method returns, result contains an object of type "); + this.Write(")val;\r\n return true;\r\n default:\r\n return Enum.TryParse(name, out result);\r\n }\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// When this method returns, result contains an object of type "); - #line 76 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 77 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); + this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); - #line 78 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 79 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write(". Note that this value need not be a member of the "); - #line 78 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 79 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n public static bool TryParse(\r\n [NotNullWhen(true)] string? name,\r\n out "); + this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n public static bool TryParse(\r\n [NotNullWhen(true)] string? name,\r\n out "); - #line 83 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 84 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (name)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (name)\r\n {\r\n"); - #line 87 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 88 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values) { @@ -213,151 +214,151 @@ public override string TransformText() #line default #line hidden - this.Write(" case nameof("); + this.Write(" case nameof("); - #line 91 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 92 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 91 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 92 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write("):\r\n result = "); + this.Write("):\r\n result = "); - #line 92 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 93 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 92 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 93 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 94 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 95 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" case { } s when TryParseNumeric(s, StringComparison.Ordinal, out "); + this.Write(" case { } s when TryParseNumeric(s, StringComparison.Ordinal, out "); - #line 97 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 98 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.UnderlyingType)); #line default #line hidden - this.Write(" val):\r\n result = ("); + this.Write(" val):\r\n result = ("); - #line 98 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 99 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(")val;\r\n return true;\r\n default:\r\n return Enum.TryParse(name, out result);\r\n }\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// When this method returns, result contains an object of type "); + this.Write(")val;\r\n return true;\r\n default:\r\n return Enum.TryParse(name, out result);\r\n }\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// When this method returns, result contains an object of type "); - #line 111 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 112 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); + this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); - #line 113 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 114 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write(". Note that this value need not be a member of the "); - #line 113 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 114 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n public static bool TryParseIgnoreCase(\r\n [NotNullWhen(true)] string? name,\r\n out "); + this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n public static bool TryParseIgnoreCase(\r\n [NotNullWhen(true)] string? name,\r\n out "); - #line 118 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 119 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n return TryParse(name, StringComparison.OrdinalIgnoreCase, out result);\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// Contains an object of type "); + this.Write(" result)\r\n {\r\n return TryParse(name, StringComparison.OrdinalIgnoreCase, out result);\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// Contains an object of type "); - #line 129 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 130 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains null value.\r\n /// \r\n public static "); + this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains null value.\r\n /// \r\n public static "); - #line 132 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 133 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryParse(string? name)\r\n {\r\n return TryParse(name, out "); + this.Write("? TryParse(string? name)\r\n {\r\n return TryParse(name, out "); - #line 134 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 135 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// Contains an object of type "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// \r\n /// Contains an object of type "); - #line 143 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 144 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains null value.\r\n /// \r\n public static "); + this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains null value.\r\n /// \r\n public static "); - #line 146 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 147 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryParseIgnoreCase(string? name)\r\n {\r\n return TryParse(name, StringComparison.OrdinalIgnoreCase, out "); + this.Write("? TryParseIgnoreCase(string? name)\r\n {\r\n return TryParse(name, StringComparison.OrdinalIgnoreCase, out "); - #line 148 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 149 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// Contains an object of type "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the name or numeric value of one or more enumerated constants to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The case-sensitive string representation of the enumeration name or underlying value to convert.\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// Contains an object of type "); - #line 158 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 159 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains null value.\r\n /// \r\n /// is not a value.\r\n public static "); + this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains null value.\r\n /// \r\n /// is not a value.\r\n public static "); - #line 162 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 163 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryParse(string? name, StringComparison comparisonType)\r\n {\r\n return TryParse(name, comparisonType, out "); + this.Write("? TryParse(string? name, StringComparison comparisonType)\r\n {\r\n return TryParse(name, comparisonType, out "); - #line 164 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 165 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n"); + this.Write(" result) ? result : null;\r\n }\r\n"); - #line 166 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 167 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * ENUM MEMBER ATTRIBUTE @@ -368,37 +369,37 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The value as defined with .\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// When this method returns, result contains an object of type "); + this.Write("\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The value as defined with .\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// When this method returns, result contains an object of type "); - #line 181 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 182 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); + this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); - #line 183 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 184 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write(". Note that this value need not be a member of the "); - #line 183 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 184 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n /// is not a value.\r\n public static bool TryParseFromEnumMemberValue(\r\n [NotNullWhen(true)] string? enumMemberValue,\r\n StringComparison comparisonType,\r\n out "); + this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n /// is not a value.\r\n public static bool TryParseFromEnumMemberValue(\r\n [NotNullWhen(true)] string? enumMemberValue,\r\n StringComparison comparisonType,\r\n out "); - #line 190 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 191 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (enumMemberValue)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (enumMemberValue)\r\n {\r\n"); - #line 194 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 195 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values) { @@ -406,111 +407,111 @@ public override string TransformText() #line default #line hidden - this.Write(" case { } s when s.Equals("); + this.Write(" case { } s when s.Equals("); - #line 198 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 199 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.SerializationValue != null ? Append($"\"{curr.SerializationValue}\"") : Append($"nameof({Model.Name}.{curr.MemberName})"))); #line default #line hidden - this.Write(", comparisonType):\r\n result = "); + this.Write(", comparisonType):\r\n result = "); - #line 202 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 203 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 202 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 203 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 204 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 205 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The value as defined with .\r\n /// \r\n /// When this method returns, result contains an object of type "); + this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object. The return value indicates whether the conversion succeeded.\r\n /// \r\n /// The value as defined with .\r\n /// \r\n /// When this method returns, result contains an object of type "); - #line 219 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 220 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); + this.Write(" whose value is represented by value\r\n /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the\r\n /// underlying type of "); - #line 221 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 222 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write(". Note that this value need not be a member of the "); - #line 221 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 222 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n public static bool TryParseFromEnumMemberValue([NotNullWhen(true)] string? enumMemberValue, out "); + this.Write(" enumeration.\r\n /// \r\n /// true if the value parameter was converted successfully; otherwise, false.\r\n public static bool TryParseFromEnumMemberValue([NotNullWhen(true)] string? enumMemberValue, out "); - #line 224 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 225 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out result);\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The value as defined with .\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// Contains an object of type "); + this.Write(" result)\r\n {\r\n return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out result);\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The value as defined with .\r\n /// One of the enumeration values that specifies how the strings will be compared.\r\n /// \r\n /// Contains an object of type "); - #line 236 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 237 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains a null value.\r\n /// \r\n /// is not a value.\r\n public static "); + this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains a null value.\r\n /// \r\n /// is not a value.\r\n public static "); - #line 240 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 241 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryParseFromEnumMemberValue(string? enumMemberValue, StringComparison comparisonType)\r\n {\r\n return TryParseFromEnumMemberValue(enumMemberValue, comparisonType, out "); + this.Write("? TryParseFromEnumMemberValue(string? enumMemberValue, StringComparison comparisonType)\r\n {\r\n return TryParseFromEnumMemberValue(enumMemberValue, comparisonType, out "); - #line 242 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 243 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The value as defined with .\r\n /// \r\n /// Contains an object of type "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n /// \r\n /// Converts the string representation of the value associated with one enumerated constant to\r\n /// an equivalent enumerated object.\r\n /// \r\n /// The value as defined with .\r\n /// \r\n /// Contains an object of type "); - #line 251 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 252 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains a null value.\r\n /// \r\n public static "); + this.Write(" whose value is represented by value if the parse operation succeeds.\r\n /// If the parse operation fails, result contains a null value.\r\n /// \r\n public static "); - #line 254 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 255 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryParseFromEnumMemberValue(string? enumMemberValue)\r\n {\r\n return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out "); + this.Write("? TryParseFromEnumMemberValue(string? enumMemberValue)\r\n {\r\n return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out "); - #line 256 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 257 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n"); + this.Write(" result) ? result : null;\r\n }\r\n"); - #line 258 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 259 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } @@ -518,7 +519,7 @@ public override string TransformText() #line default #line hidden - #line 261 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 262 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * DESCRIPTION ATTRIBUTE @@ -529,16 +530,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static bool TryCreateFromDescription(\r\n [NotNullWhen(true)] string? description,\r\n StringComparison comparisonType,\r\n out "); + this.Write("\r\n public static bool TryCreateFromDescription(\r\n [NotNullWhen(true)] string? description,\r\n StringComparison comparisonType,\r\n out "); - #line 272 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 273 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (description)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (description)\r\n {\r\n"); - #line 276 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 277 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values.Where(x => x.Description != null)) { @@ -546,74 +547,74 @@ public override string TransformText() #line default #line hidden - this.Write(" case { } s when s.Equals(\""); + this.Write(" case { } s when s.Equals(\""); - #line 280 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 281 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Description)); #line default #line hidden - this.Write("\", comparisonType):\r\n result = "); + this.Write("\", comparisonType):\r\n result = "); - #line 281 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 282 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 281 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 282 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 283 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 284 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out "); + this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out "); - #line 292 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 293 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); + this.Write(" result)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); - #line 297 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 298 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDescription(string? description, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDescription(description, comparisonType, out "); + this.Write("? TryCreateFromDescription(string? description, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDescription(description, comparisonType, out "); - #line 299 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 300 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); - #line 302 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 303 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDescription(string? description)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out "); + this.Write("? TryCreateFromDescription(string? description)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out "); - #line 304 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 305 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n"); + this.Write(" result) ? result : null;\r\n }\r\n"); - #line 306 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 307 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } @@ -621,7 +622,7 @@ public override string TransformText() #line default #line hidden - #line 309 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 310 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * DISPLAY ATTRIBUTE @@ -632,16 +633,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static bool TryCreateFromDisplayShortName(\r\n [NotNullWhen(true)] string? displayShortName,\r\n StringComparison comparisonType,\r\n out "); + this.Write("\r\n public static bool TryCreateFromDisplayShortName(\r\n [NotNullWhen(true)] string? displayShortName,\r\n StringComparison comparisonType,\r\n out "); - #line 320 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 321 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (displayShortName)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (displayShortName)\r\n {\r\n"); - #line 324 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 325 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values.Where(x => x.Display?.ShortName != null)) { @@ -649,83 +650,83 @@ public override string TransformText() #line default #line hidden - this.Write(" case { } s when s.Equals("); + this.Write(" case { } s when s.Equals("); - #line 328 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 329 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Display!.ResourceShortName != null ? Append(curr.Display.ResourceShortName) : Append($"\"{curr.Display.ShortName}\""))); #line default #line hidden - this.Write(", comparisonType):\r\n result = "); + this.Write(", comparisonType):\r\n result = "); - #line 332 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 333 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 332 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 333 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 334 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 335 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" default:\r\n return TryCreateFromDisplayName(displayShortName, comparisonType, out result);\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDisplayShortName([NotNullWhen(true)] string? displayShortName, out "); + this.Write(" default:\r\n return TryCreateFromDisplayName(displayShortName, comparisonType, out result);\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDisplayShortName([NotNullWhen(true)] string? displayShortName, out "); - #line 342 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 343 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); + this.Write(" result)\r\n {\r\n return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); - #line 347 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 348 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDisplayShortName(string? displayShortName, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDisplayShortName(displayShortName, comparisonType, out "); + this.Write("? TryCreateFromDisplayShortName(string? displayShortName, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDisplayShortName(displayShortName, comparisonType, out "); - #line 349 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 350 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); - #line 352 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 353 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDisplayShortName(string? displayShortName)\r\n {\r\n return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out "); + this.Write("? TryCreateFromDisplayShortName(string? displayShortName)\r\n {\r\n return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out "); - #line 354 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 355 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n public static bool TryCreateFromDisplayName(\r\n [NotNullWhen(true)] string? displayName,\r\n StringComparison comparisonType,\r\n out "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n public static bool TryCreateFromDisplayName(\r\n [NotNullWhen(true)] string? displayName,\r\n StringComparison comparisonType,\r\n out "); - #line 360 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 361 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (displayName)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (displayName)\r\n {\r\n"); - #line 364 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 365 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values) { @@ -733,9 +734,9 @@ public override string TransformText() #line default #line hidden - this.Write(" case { } s when s.Equals("); + this.Write(" case { } s when s.Equals("); - #line 368 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 369 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Display?.ResourceName != null ? Append(curr.Display.ResourceName) : curr.Display?.Name != null @@ -744,67 +745,67 @@ public override string TransformText() #line default #line hidden - this.Write(", comparisonType):\r\n result = "); + this.Write(", comparisonType):\r\n result = "); - #line 374 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 375 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 374 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 375 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 376 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 377 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDisplayName([NotNullWhen(true)] string? displayName, out "); + this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDisplayName([NotNullWhen(true)] string? displayName, out "); - #line 385 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 386 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); + this.Write(" result)\r\n {\r\n return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); - #line 390 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 391 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDisplayName(string? displayName, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDisplayName(displayName, comparisonType, out "); + this.Write("? TryCreateFromDisplayName(string? displayName, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDisplayName(displayName, comparisonType, out "); - #line 392 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 393 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); - #line 395 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 396 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDisplayName(string? displayName)\r\n {\r\n return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out "); + this.Write("? TryCreateFromDisplayName(string? displayName)\r\n {\r\n return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out "); - #line 397 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 398 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n"); + this.Write(" result) ? result : null;\r\n }\r\n"); - #line 399 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 400 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } @@ -812,7 +813,7 @@ public override string TransformText() #line default #line hidden - #line 402 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 403 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" if (Model.HasDisplayDescription) { @@ -820,16 +821,16 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n public static bool TryCreateFromDescription(\r\n [NotNullWhen(true)] string? description,\r\n StringComparison comparisonType,\r\n out "); + this.Write("\r\n public static bool TryCreateFromDescription(\r\n [NotNullWhen(true)] string? description,\r\n StringComparison comparisonType,\r\n out "); - #line 410 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 411 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (description)\r\n {\r\n"); + this.Write(" result)\r\n {\r\n switch (description)\r\n {\r\n"); - #line 414 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 415 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values.Where(x => x.Display?.Description != null)) { @@ -837,76 +838,76 @@ public override string TransformText() #line default #line hidden - this.Write(" case { } s when s.Equals("); + this.Write(" case { } s when s.Equals("); - #line 418 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 419 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.Display!.ResourceDescription != null ? Append(curr.Display.ResourceDescription) : Append($"\"{curr.Display.Description}\""))); #line default #line hidden - this.Write(", comparisonType):\r\n result = "); + this.Write(", comparisonType):\r\n result = "); - #line 422 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 423 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 422 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 423 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden - this.Write(";\r\n return true;\r\n"); + this.Write(";\r\n return true;\r\n"); - #line 424 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 425 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out "); + this.Write(" default:\r\n result = default;\r\n return false;\r\n }\r\n }\r\n\r\n public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out "); - #line 433 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 434 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); + this.Write(" result)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out result);\r\n }\r\n\r\n public static "); - #line 438 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 439 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDescription(string? description, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDescription(description, comparisonType, out "); + this.Write("? TryCreateFromDescription(string? description, StringComparison comparisonType)\r\n {\r\n return TryCreateFromDescription(description, comparisonType, out "); - #line 440 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 441 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); + this.Write(" result) ? result : null;\r\n }\r\n\r\n public static "); - #line 443 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 444 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("? TryCreateFromDescription(string? description)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out "); + this.Write("? TryCreateFromDescription(string? description)\r\n {\r\n return TryCreateFromDescription(description, StringComparison.Ordinal, out "); - #line 445 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 446 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" result) ? result : null;\r\n }\r\n"); + this.Write(" result) ? result : null;\r\n }\r\n"); - #line 447 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 448 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } @@ -914,7 +915,7 @@ public override string TransformText() #line default #line hidden - #line 450 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 451 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" /* ----------------------------------------------------------------------------------------------------------------- * MISCELLANEOUS @@ -923,30 +924,30 @@ public override string TransformText() #line default #line hidden - this.Write("\r\n /// Retrieves an array of the values of the constants in the "); + this.Write("\r\n /// Retrieves an array of the values of the constants in the "); - #line 456 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 457 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// An array that contains the values of the constants in "); + this.Write(" enumeration.\r\n /// An array that contains the values of the constants in "); - #line 457 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 458 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(".\r\n public static "); + this.Write(".\r\n public static "); - #line 458 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 459 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("[] GetValues()\r\n {\r\n return new[]\r\n {\r\n"); + this.Write("[] GetValues()\r\n {\r\n return new[]\r\n {\r\n"); - #line 462 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 463 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.UniqueValues) { @@ -954,46 +955,46 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 466 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 467 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 466 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 467 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(",\r\n"); - #line 467 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 468 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" };\r\n }\r\n\r\n /// Retrieves an array of the names of the constants in "); + this.Write(" };\r\n }\r\n\r\n /// Retrieves an array of the names of the constants in "); - #line 473 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 474 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" enumeration.\r\n /// A string array of the names of the constants in "); + this.Write(" enumeration.\r\n /// A string array of the names of the constants in "); - #line 474 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 475 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(".\r\n public static string[] GetNames()\r\n {\r\n return new[]\r\n {\r\n"); + this.Write(".\r\n public static string[] GetNames()\r\n {\r\n return new[]\r\n {\r\n"); - #line 479 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 480 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" foreach (var curr in Model.Values) { @@ -1001,70 +1002,71 @@ public override string TransformText() #line default #line hidden - this.Write(" nameof("); + this.Write(" nameof("); - #line 483 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 484 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 483 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 484 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write("),\r\n"); - #line 484 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 485 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } #line default #line hidden - this.Write(" };\r\n }\r\n\r\n private static bool TryParseNumeric(\r\n string name,\r\n StringComparison comparisonType,\r\n out "); + this.Write(" };\r\n }\r\n\r\n private static bool TryParseNumeric(\r\n string name,\r\n StringComparison comparisonType,\r\n out "); - #line 493 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 494 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.UnderlyingType)); #line default #line hidden - this.Write(" result)\r\n {\r\n switch (comparisonType)\r\n {\r\n case StringComparison.CurrentCulture:\r\n case StringComparison.CurrentCultureIgnoreCase:\r\n return "); + this.Write(" result)\r\n {\r\n switch (comparisonType)\r\n {\r\n case StringComparison.CurrentCulture:\r\n case StringComparison.CurrentCultureIgnoreCase:\r\n return "); - #line 499 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 500 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.UnderlyingType)); #line default #line hidden - this.Write(".TryParse(name, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);\r\n case StringComparison.InvariantCulture:\r\n case StringComparison.InvariantCultureIgnoreCase:\r\n case StringComparison.Ordinal:\r\n case StringComparison.OrdinalIgnoreCase:\r\n return "); + this.Write(".TryParse(name, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);\r\n case StringComparison.InvariantCulture:\r\n case StringComparison.InvariantCultureIgnoreCase:\r\n case StringComparison.Ordinal:\r\n case StringComparison.OrdinalIgnoreCase:\r\n return "); - #line 504 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 505 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.UnderlyingType)); #line default #line hidden - this.Write(".TryParse(name, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result);\r\n default:\r\n return "); + this.Write(".TryParse(name, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result);\r\n default:\r\n return "); - #line 506 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 507 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.UnderlyingType)); #line default #line hidden - this.Write(".TryParse(name, out result);\r\n }\r\n }\r\n }\r\n"); + this.Write(".TryParse(name, out result);\r\n }\r\n }\r\n}\r\n"); - #line 510 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 511 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" if (!string.IsNullOrEmpty(Model.Namespace)) { + PopIndent(); #line default #line hidden this.Write("}\r\n"); - #line 515 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 517 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" } @@ -1074,7 +1076,7 @@ public override string TransformText() return this.GenerationEnvironment.ToString(); } - #line 518 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" + #line 520 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumFactoryWriter.tt" public EnumFactoryWriter(StringBuilder builder) : base(builder) { diff --git a/src/EnumUtilities/CodeWriters/EnumFactoryWriter.tt b/src/EnumUtilities/CodeWriters/EnumFactoryWriter.tt index 1a57579..11c8481 100644 --- a/src/EnumUtilities/CodeWriters/EnumFactoryWriter.tt +++ b/src/EnumUtilities/CodeWriters/EnumFactoryWriter.tt @@ -18,151 +18,152 @@ using System.Globalization; namespace <#= Model.Namespace #> { <# + PushIndent(); } #> - [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#= CurrentAssemblyName.Name #>", "<#= Append($"{CurrentAssemblyName.Version}") #>")] - public static partial class <#= Model.Name #>Factory - { +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +[global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#= CurrentAssemblyName.Name #>", "<#= Append($"{CurrentAssemblyName.Version}") #>")] +public static partial class <#= Model.Name #>Factory +{ <# /* ----------------------------------------------------------------------------------------------------------------- * DEFAULT * -------------------------------------------------------------------------------------------------------------- */ #> - /// - /// Converts the string representation of the name or numeric value of one or more enumerated constants to - /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. - /// - /// The case-sensitive string representation of the enumeration name or underlying value to convert. - /// One of the enumeration values that specifies how the strings will be compared. - /// - /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value - /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the - /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. - /// - /// true if the value parameter was converted successfully; otherwise, false. - /// is not a value. - public static bool TryParse( - [NotNullWhen(true)] string? name, - StringComparison comparisonType, - out <#= Model.Name #> result) + /// + /// Converts the string representation of the name or numeric value of one or more enumerated constants to + /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. + /// + /// The case-sensitive string representation of the enumeration name or underlying value to convert. + /// One of the enumeration values that specifies how the strings will be compared. + /// + /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value + /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the + /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. + /// + /// true if the value parameter was converted successfully; otherwise, false. + /// is not a value. + public static bool TryParse( + [NotNullWhen(true)] string? name, + StringComparison comparisonType, + out <#= Model.Name #> result) + { + switch (name) { - switch (name) - { <# foreach (var curr in Model.Values) { #> - case { } s when s.Equals(nameof(<#= Model.Name #>.<#= curr.MemberName #>), comparisonType): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + case { } s when s.Equals(nameof(<#= Model.Name #>.<#= curr.MemberName #>), comparisonType): + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - case { } s when TryParseNumeric(s, comparisonType, out <#= Model.UnderlyingType #> val): - result = (<#= Model.Name #>)val; - return true; - default: - return Enum.TryParse(name, out result); - } + case { } s when TryParseNumeric(s, comparisonType, out <#= Model.UnderlyingType #> val): + result = (<#= Model.Name #>)val; + return true; + default: + return Enum.TryParse(name, out result); } + } - /// - /// Converts the string representation of the name or numeric value of one or more enumerated constants to - /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. - /// - /// The case-sensitive string representation of the enumeration name or underlying value to convert. - /// - /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value - /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the - /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. - /// - /// true if the value parameter was converted successfully; otherwise, false. - public static bool TryParse( - [NotNullWhen(true)] string? name, - out <#= Model.Name #> result) + /// + /// Converts the string representation of the name or numeric value of one or more enumerated constants to + /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. + /// + /// The case-sensitive string representation of the enumeration name or underlying value to convert. + /// + /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value + /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the + /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. + /// + /// true if the value parameter was converted successfully; otherwise, false. + public static bool TryParse( + [NotNullWhen(true)] string? name, + out <#= Model.Name #> result) + { + switch (name) { - switch (name) - { <# foreach (var curr in Model.Values) { #> - case nameof(<#= Model.Name #>.<#= curr.MemberName #>): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + case nameof(<#= Model.Name #>.<#= curr.MemberName #>): + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - case { } s when TryParseNumeric(s, StringComparison.Ordinal, out <#= Model.UnderlyingType #> val): - result = (<#= Model.Name #>)val; - return true; - default: - return Enum.TryParse(name, out result); - } + case { } s when TryParseNumeric(s, StringComparison.Ordinal, out <#= Model.UnderlyingType #> val): + result = (<#= Model.Name #>)val; + return true; + default: + return Enum.TryParse(name, out result); } + } - /// - /// Converts the string representation of the name or numeric value of one or more enumerated constants to - /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. - /// - /// The case-sensitive string representation of the enumeration name or underlying value to convert. - /// - /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value - /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the - /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. - /// - /// true if the value parameter was converted successfully; otherwise, false. - public static bool TryParseIgnoreCase( - [NotNullWhen(true)] string? name, - out <#= Model.Name #> result) - { - return TryParse(name, StringComparison.OrdinalIgnoreCase, out result); - } + /// + /// Converts the string representation of the name or numeric value of one or more enumerated constants to + /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. + /// + /// The case-sensitive string representation of the enumeration name or underlying value to convert. + /// + /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value + /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the + /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. + /// + /// true if the value parameter was converted successfully; otherwise, false. + public static bool TryParseIgnoreCase( + [NotNullWhen(true)] string? name, + out <#= Model.Name #> result) + { + return TryParse(name, StringComparison.OrdinalIgnoreCase, out result); + } - /// - /// Converts the string representation of the name or numeric value of one or more enumerated constants to - /// an equivalent enumerated object. - /// - /// The case-sensitive string representation of the enumeration name or underlying value to convert. - /// - /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. - /// If the parse operation fails, result contains null value. - /// - public static <#= Model.Name #>? TryParse(string? name) - { - return TryParse(name, out <#= Model.Name #> result) ? result : null; - } + /// + /// Converts the string representation of the name or numeric value of one or more enumerated constants to + /// an equivalent enumerated object. + /// + /// The case-sensitive string representation of the enumeration name or underlying value to convert. + /// + /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. + /// If the parse operation fails, result contains null value. + /// + public static <#= Model.Name #>? TryParse(string? name) + { + return TryParse(name, out <#= Model.Name #> result) ? result : null; + } - /// - /// Converts the string representation of the name or numeric value of one or more enumerated constants to - /// an equivalent enumerated object. - /// - /// The case-sensitive string representation of the enumeration name or underlying value to convert. - /// - /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. - /// If the parse operation fails, result contains null value. - /// - public static <#= Model.Name #>? TryParseIgnoreCase(string? name) - { - return TryParse(name, StringComparison.OrdinalIgnoreCase, out <#= Model.Name #> result) ? result : null; - } + /// + /// Converts the string representation of the name or numeric value of one or more enumerated constants to + /// an equivalent enumerated object. + /// + /// The case-sensitive string representation of the enumeration name or underlying value to convert. + /// + /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. + /// If the parse operation fails, result contains null value. + /// + public static <#= Model.Name #>? TryParseIgnoreCase(string? name) + { + return TryParse(name, StringComparison.OrdinalIgnoreCase, out <#= Model.Name #> result) ? result : null; + } - /// - /// Converts the string representation of the name or numeric value of one or more enumerated constants to - /// an equivalent enumerated object. - /// - /// The case-sensitive string representation of the enumeration name or underlying value to convert. - /// One of the enumeration values that specifies how the strings will be compared. - /// - /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. - /// If the parse operation fails, result contains null value. - /// - /// is not a value. - public static <#= Model.Name #>? TryParse(string? name, StringComparison comparisonType) - { - return TryParse(name, comparisonType, out <#= Model.Name #> result) ? result : null; - } + /// + /// Converts the string representation of the name or numeric value of one or more enumerated constants to + /// an equivalent enumerated object. + /// + /// The case-sensitive string representation of the enumeration name or underlying value to convert. + /// One of the enumeration values that specifies how the strings will be compared. + /// + /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. + /// If the parse operation fails, result contains null value. + /// + /// is not a value. + public static <#= Model.Name #>? TryParse(string? name, StringComparison comparisonType) + { + return TryParse(name, comparisonType, out <#= Model.Name #> result) ? result : null; + } <# /* ----------------------------------------------------------------------------------------------------------------- * ENUM MEMBER ATTRIBUTE @@ -171,90 +172,90 @@ namespace <#= Model.Namespace #> { #> - /// - /// Converts the string representation of the value associated with one enumerated constant to - /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. - /// - /// The value as defined with . - /// One of the enumeration values that specifies how the strings will be compared. - /// - /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value - /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the - /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. - /// - /// true if the value parameter was converted successfully; otherwise, false. - /// is not a value. - public static bool TryParseFromEnumMemberValue( - [NotNullWhen(true)] string? enumMemberValue, - StringComparison comparisonType, - out <#= Model.Name #> result) + /// + /// Converts the string representation of the value associated with one enumerated constant to + /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. + /// + /// The value as defined with . + /// One of the enumeration values that specifies how the strings will be compared. + /// + /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value + /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the + /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. + /// + /// true if the value parameter was converted successfully; otherwise, false. + /// is not a value. + public static bool TryParseFromEnumMemberValue( + [NotNullWhen(true)] string? enumMemberValue, + StringComparison comparisonType, + out <#= Model.Name #> result) + { + switch (enumMemberValue) { - switch (enumMemberValue) - { <# foreach (var curr in Model.Values) { #> - case { } s when s.Equals(<#= + case { } s when s.Equals(<#= curr.SerializationValue != null ? Append($"\"{curr.SerializationValue}\"") : Append($"nameof({Model.Name}.{curr.MemberName})") #>, comparisonType): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - default: - result = default; - return false; - } + default: + result = default; + return false; } + } - /// - /// Converts the string representation of the value associated with one enumerated constant to - /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. - /// - /// The value as defined with . - /// - /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value - /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the - /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. - /// - /// true if the value parameter was converted successfully; otherwise, false. - public static bool TryParseFromEnumMemberValue([NotNullWhen(true)] string? enumMemberValue, out <#= Model.Name #> result) - { - return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out result); - } + /// + /// Converts the string representation of the value associated with one enumerated constant to + /// an equivalent enumerated object. The return value indicates whether the conversion succeeded. + /// + /// The value as defined with . + /// + /// When this method returns, result contains an object of type <#= Model.Name #> whose value is represented by value + /// if the parse operation succeeds. If the parse operation fails, result contains the default value of the + /// underlying type of <#= Model.Name #>. Note that this value need not be a member of the <#= Model.Name #> enumeration. + /// + /// true if the value parameter was converted successfully; otherwise, false. + public static bool TryParseFromEnumMemberValue([NotNullWhen(true)] string? enumMemberValue, out <#= Model.Name #> result) + { + return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out result); + } - /// - /// Converts the string representation of the value associated with one enumerated constant to - /// an equivalent enumerated object. - /// - /// The value as defined with . - /// One of the enumeration values that specifies how the strings will be compared. - /// - /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. - /// If the parse operation fails, result contains a null value. - /// - /// is not a value. - public static <#= Model.Name #>? TryParseFromEnumMemberValue(string? enumMemberValue, StringComparison comparisonType) - { - return TryParseFromEnumMemberValue(enumMemberValue, comparisonType, out <#= Model.Name #> result) ? result : null; - } + /// + /// Converts the string representation of the value associated with one enumerated constant to + /// an equivalent enumerated object. + /// + /// The value as defined with . + /// One of the enumeration values that specifies how the strings will be compared. + /// + /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. + /// If the parse operation fails, result contains a null value. + /// + /// is not a value. + public static <#= Model.Name #>? TryParseFromEnumMemberValue(string? enumMemberValue, StringComparison comparisonType) + { + return TryParseFromEnumMemberValue(enumMemberValue, comparisonType, out <#= Model.Name #> result) ? result : null; + } - /// - /// Converts the string representation of the value associated with one enumerated constant to - /// an equivalent enumerated object. - /// - /// The value as defined with . - /// - /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. - /// If the parse operation fails, result contains a null value. - /// - public static <#= Model.Name #>? TryParseFromEnumMemberValue(string? enumMemberValue) - { - return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; - } + /// + /// Converts the string representation of the value associated with one enumerated constant to + /// an equivalent enumerated object. + /// + /// The value as defined with . + /// + /// Contains an object of type <#= Model.Name #> whose value is represented by value if the parse operation succeeds. + /// If the parse operation fails, result contains a null value. + /// + public static <#= Model.Name #>? TryParseFromEnumMemberValue(string? enumMemberValue) + { + return TryParseFromEnumMemberValue(enumMemberValue, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; + } <# } #> @@ -266,43 +267,43 @@ namespace <#= Model.Namespace #> { #> - public static bool TryCreateFromDescription( - [NotNullWhen(true)] string? description, - StringComparison comparisonType, - out <#= Model.Name #> result) + public static bool TryCreateFromDescription( + [NotNullWhen(true)] string? description, + StringComparison comparisonType, + out <#= Model.Name #> result) + { + switch (description) { - switch (description) - { <# foreach (var curr in Model.Values.Where(x => x.Description != null)) { #> - case { } s when s.Equals("<#= curr.Description #>", comparisonType): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + case { } s when s.Equals("<#= curr.Description #>", comparisonType): + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - default: - result = default; - return false; - } + default: + result = default; + return false; } + } - public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out <#= Model.Name #> result) - { - return TryCreateFromDescription(description, StringComparison.Ordinal, out result); - } + public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out <#= Model.Name #> result) + { + return TryCreateFromDescription(description, StringComparison.Ordinal, out result); + } - public static <#= Model.Name #>? TryCreateFromDescription(string? description, StringComparison comparisonType) - { - return TryCreateFromDescription(description, comparisonType, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDescription(string? description, StringComparison comparisonType) + { + return TryCreateFromDescription(description, comparisonType, out <#= Model.Name #> result) ? result : null; + } - public static <#= Model.Name #>? TryCreateFromDescription(string? description) - { - return TryCreateFromDescription(description, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDescription(string? description) + { + return TryCreateFromDescription(description, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; + } <# } #> @@ -314,88 +315,88 @@ namespace <#= Model.Namespace #> { #> - public static bool TryCreateFromDisplayShortName( - [NotNullWhen(true)] string? displayShortName, - StringComparison comparisonType, - out <#= Model.Name #> result) + public static bool TryCreateFromDisplayShortName( + [NotNullWhen(true)] string? displayShortName, + StringComparison comparisonType, + out <#= Model.Name #> result) + { + switch (displayShortName) { - switch (displayShortName) - { <# foreach (var curr in Model.Values.Where(x => x.Display?.ShortName != null)) { #> - case { } s when s.Equals(<#= + case { } s when s.Equals(<#= curr.Display!.ResourceShortName != null ? Append(curr.Display.ResourceShortName) : Append($"\"{curr.Display.ShortName}\"") #>, comparisonType): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - default: - return TryCreateFromDisplayName(displayShortName, comparisonType, out result); - } + default: + return TryCreateFromDisplayName(displayShortName, comparisonType, out result); } + } - public static bool TryCreateFromDisplayShortName([NotNullWhen(true)] string? displayShortName, out <#= Model.Name #> result) - { - return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out result); - } + public static bool TryCreateFromDisplayShortName([NotNullWhen(true)] string? displayShortName, out <#= Model.Name #> result) + { + return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out result); + } - public static <#= Model.Name #>? TryCreateFromDisplayShortName(string? displayShortName, StringComparison comparisonType) - { - return TryCreateFromDisplayShortName(displayShortName, comparisonType, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDisplayShortName(string? displayShortName, StringComparison comparisonType) + { + return TryCreateFromDisplayShortName(displayShortName, comparisonType, out <#= Model.Name #> result) ? result : null; + } - public static <#= Model.Name #>? TryCreateFromDisplayShortName(string? displayShortName) - { - return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDisplayShortName(string? displayShortName) + { + return TryCreateFromDisplayShortName(displayShortName, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; + } - public static bool TryCreateFromDisplayName( - [NotNullWhen(true)] string? displayName, - StringComparison comparisonType, - out <#= Model.Name #> result) + public static bool TryCreateFromDisplayName( + [NotNullWhen(true)] string? displayName, + StringComparison comparisonType, + out <#= Model.Name #> result) + { + switch (displayName) { - switch (displayName) - { <# foreach (var curr in Model.Values) { #> - case { } s when s.Equals(<#= + case { } s when s.Equals(<#= curr.Display?.ResourceName != null ? Append(curr.Display.ResourceName) : curr.Display?.Name != null ? Append($"\"{curr.Display.Name}\"") : Append($"nameof({Model.Name}.{curr.MemberName})") #>, comparisonType): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - default: - result = default; - return false; - } + default: + result = default; + return false; } + } - public static bool TryCreateFromDisplayName([NotNullWhen(true)] string? displayName, out <#= Model.Name #> result) - { - return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out result); - } + public static bool TryCreateFromDisplayName([NotNullWhen(true)] string? displayName, out <#= Model.Name #> result) + { + return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out result); + } - public static <#= Model.Name #>? TryCreateFromDisplayName(string? displayName, StringComparison comparisonType) - { - return TryCreateFromDisplayName(displayName, comparisonType, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDisplayName(string? displayName, StringComparison comparisonType) + { + return TryCreateFromDisplayName(displayName, comparisonType, out <#= Model.Name #> result) ? result : null; + } - public static <#= Model.Name #>? TryCreateFromDisplayName(string? displayName) - { - return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDisplayName(string? displayName) + { + return TryCreateFromDisplayName(displayName, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; + } <# } #> @@ -404,46 +405,46 @@ namespace <#= Model.Namespace #> { #> - public static bool TryCreateFromDescription( - [NotNullWhen(true)] string? description, - StringComparison comparisonType, - out <#= Model.Name #> result) + public static bool TryCreateFromDescription( + [NotNullWhen(true)] string? description, + StringComparison comparisonType, + out <#= Model.Name #> result) + { + switch (description) { - switch (description) - { <# foreach (var curr in Model.Values.Where(x => x.Display?.Description != null)) { #> - case { } s when s.Equals(<#= + case { } s when s.Equals(<#= curr.Display!.ResourceDescription != null ? Append(curr.Display.ResourceDescription) : Append($"\"{curr.Display.Description}\"") #>, comparisonType): - result = <#= Model.Name #>.<#= curr.MemberName #>; - return true; + result = <#= Model.Name #>.<#= curr.MemberName #>; + return true; <# } #> - default: - result = default; - return false; - } + default: + result = default; + return false; } + } - public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out <#= Model.Name #> result) - { - return TryCreateFromDescription(description, StringComparison.Ordinal, out result); - } + public static bool TryCreateFromDescription([NotNullWhen(true)] string? description, out <#= Model.Name #> result) + { + return TryCreateFromDescription(description, StringComparison.Ordinal, out result); + } - public static <#= Model.Name #>? TryCreateFromDescription(string? description, StringComparison comparisonType) - { - return TryCreateFromDescription(description, comparisonType, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDescription(string? description, StringComparison comparisonType) + { + return TryCreateFromDescription(description, comparisonType, out <#= Model.Name #> result) ? result : null; + } - public static <#= Model.Name #>? TryCreateFromDescription(string? description) - { - return TryCreateFromDescription(description, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; - } + public static <#= Model.Name #>? TryCreateFromDescription(string? description) + { + return TryCreateFromDescription(description, StringComparison.Ordinal, out <#= Model.Name #> result) ? result : null; + } <# } #> @@ -453,63 +454,64 @@ namespace <#= Model.Namespace #> * -------------------------------------------------------------------------------------------------------------- */ #> - /// Retrieves an array of the values of the constants in the <#= Model.Name #> enumeration. - /// An array that contains the values of the constants in <#= Model.Name #>. - public static <#= Model.Name #>[] GetValues() + /// Retrieves an array of the values of the constants in the <#= Model.Name #> enumeration. + /// An array that contains the values of the constants in <#= Model.Name #>. + public static <#= Model.Name #>[] GetValues() + { + return new[] { - return new[] - { <# foreach (var curr in Model.UniqueValues) { #> - <#= Model.Name #>.<#= curr.MemberName #>, + <#= Model.Name #>.<#= curr.MemberName #>, <# } #> - }; - } + }; + } - /// Retrieves an array of the names of the constants in <#= Model.Name #> enumeration. - /// A string array of the names of the constants in <#= Model.Name #>. - public static string[] GetNames() + /// Retrieves an array of the names of the constants in <#= Model.Name #> enumeration. + /// A string array of the names of the constants in <#= Model.Name #>. + public static string[] GetNames() + { + return new[] { - return new[] - { <# foreach (var curr in Model.Values) { #> - nameof(<#= Model.Name #>.<#= curr.MemberName #>), + nameof(<#= Model.Name #>.<#= curr.MemberName #>), <# } #> - }; - } + }; + } - private static bool TryParseNumeric( - string name, - StringComparison comparisonType, - out <#= Model.UnderlyingType #> result) - { - switch (comparisonType) - { - case StringComparison.CurrentCulture: - case StringComparison.CurrentCultureIgnoreCase: - return <#= Model.UnderlyingType #>.TryParse(name, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result); - case StringComparison.InvariantCulture: - case StringComparison.InvariantCultureIgnoreCase: - case StringComparison.Ordinal: - case StringComparison.OrdinalIgnoreCase: - return <#= Model.UnderlyingType #>.TryParse(name, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result); - default: - return <#= Model.UnderlyingType #>.TryParse(name, out result); - } + private static bool TryParseNumeric( + string name, + StringComparison comparisonType, + out <#= Model.UnderlyingType #> result) + { + switch (comparisonType) + { + case StringComparison.CurrentCulture: + case StringComparison.CurrentCultureIgnoreCase: + return <#= Model.UnderlyingType #>.TryParse(name, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result); + case StringComparison.InvariantCulture: + case StringComparison.InvariantCultureIgnoreCase: + case StringComparison.Ordinal: + case StringComparison.OrdinalIgnoreCase: + return <#= Model.UnderlyingType #>.TryParse(name, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result); + default: + return <#= Model.UnderlyingType #>.TryParse(name, out result); } } +} <# if (!string.IsNullOrEmpty(Model.Namespace)) { + PopIndent(); #> } <# diff --git a/src/EnumUtilities/CodeWriters/EnumValidationWriter.cs b/src/EnumUtilities/CodeWriters/EnumValidationWriter.cs index 542a97e..a99ed94 100644 --- a/src/EnumUtilities/CodeWriters/EnumValidationWriter.cs +++ b/src/EnumUtilities/CodeWriters/EnumValidationWriter.cs @@ -49,56 +49,57 @@ public override string TransformText() #line 19 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + PushIndent(); } #line default #line hidden - this.Write(" [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\r\n [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\""); + this.Write("[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\r\n[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\""); - #line 23 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 24 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(CurrentAssemblyName.Name)); #line default #line hidden this.Write("\", \""); - #line 23 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 24 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Append($"{CurrentAssemblyName.Version}"))); #line default #line hidden - this.Write("\")]\r\n public static partial class "); + this.Write("\")]\r\npublic static partial class "); - #line 24 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 25 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write("Validation\r\n {\r\n /// Returns a boolean telling whether the value of Returns a boolean telling whether the value of \r\n /// true if the value of instance exists in the enumeration.\r\n /// true if the value of \r\n public static bool IsDefined("); + this.Write("\"/> instance exists in the enumeration; false otherwise.\r\n public static bool IsDefined("); - #line 28 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 29 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden - this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); + this.Write(" value)\r\n {\r\n return value switch\r\n {\r\n"); - #line 32 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 33 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" foreach (var curr in Model.UniqueValues) { @@ -106,32 +107,32 @@ public override string TransformText() #line default #line hidden - this.Write(" "); + this.Write(" "); - #line 36 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 37 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 36 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 37 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(" => true,\r\n"); - #line 37 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 38 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" } #line default #line hidden - this.Write(" _ => false\r\n };\r\n }\r\n\r\n public static bool IsDefined(\r\n [NotNullWhen(true)] string? name,\r\n StringComparison comparisonType)\r\n {\r\n return name switch\r\n {\r\n"); + this.Write(" _ => false\r\n };\r\n }\r\n\r\n public static bool IsDefined(\r\n [NotNullWhen(true)] string? name,\r\n StringComparison comparisonType)\r\n {\r\n return name switch\r\n {\r\n"); - #line 50 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 51 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" foreach (var curr in Model.Values) { @@ -139,32 +140,32 @@ public override string TransformText() #line default #line hidden - this.Write(" { } s when s.Equals(nameof("); + this.Write(" { } s when s.Equals(nameof("); - #line 54 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 55 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 54 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 55 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write("), comparisonType) => true,\r\n"); - #line 55 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 56 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" } #line default #line hidden - this.Write(" _ => false\r\n };\r\n }\r\n\r\n public static bool IsDefinedIgnoreCase([NotNullWhen(true)] string? name)\r\n {\r\n return IsDefined(name, StringComparison.OrdinalIgnoreCase);\r\n }\r\n\r\n public static bool IsDefined([NotNullWhen(true)] string? name)\r\n {\r\n return name switch\r\n {\r\n"); + this.Write(" _ => false\r\n };\r\n }\r\n\r\n public static bool IsDefinedIgnoreCase([NotNullWhen(true)] string? name)\r\n {\r\n return IsDefined(name, StringComparison.OrdinalIgnoreCase);\r\n }\r\n\r\n public static bool IsDefined([NotNullWhen(true)] string? name)\r\n {\r\n return name switch\r\n {\r\n"); - #line 71 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 72 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" foreach (var curr in Model.Values) { @@ -172,42 +173,43 @@ public override string TransformText() #line default #line hidden - this.Write(" nameof("); + this.Write(" nameof("); - #line 75 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 76 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Model.Name)); #line default #line hidden this.Write("."); - #line 75 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 76 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" this.Write(this.ToStringHelper.ToStringWithCulture(curr.MemberName)); #line default #line hidden this.Write(") => true,\r\n"); - #line 76 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 77 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" } #line default #line hidden - this.Write(" _ => false\r\n };\r\n }\r\n }\r\n"); + this.Write(" _ => false\r\n };\r\n }\r\n}\r\n"); - #line 83 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 84 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" if (!string.IsNullOrEmpty(Model.Namespace)) { + PopIndent(); #line default #line hidden this.Write("}\r\n"); - #line 88 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 90 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" } @@ -217,7 +219,7 @@ public override string TransformText() return this.GenerationEnvironment.ToString(); } - #line 91 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" + #line 93 "C:\Users\skarl\source\repos\github\skarllot\EnumUtilities\src\EnumUtilities\CodeWriters\EnumValidationWriter.tt" public EnumValidationWriter(StringBuilder builder) : base(builder) { diff --git a/src/EnumUtilities/CodeWriters/EnumValidationWriter.tt b/src/EnumUtilities/CodeWriters/EnumValidationWriter.tt index 5c3da49..cffaf95 100644 --- a/src/EnumUtilities/CodeWriters/EnumValidationWriter.tt +++ b/src/EnumUtilities/CodeWriters/EnumValidationWriter.tt @@ -17,72 +17,74 @@ using System.Diagnostics.CodeAnalysis; namespace <#= Model.Namespace #> { <# + PushIndent(); } #> - [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#= CurrentAssemblyName.Name #>", "<#= Append($"{CurrentAssemblyName.Version}") #>")] - public static partial class <#= Model.Name #>Validation +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] +[global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#= CurrentAssemblyName.Name #>", "<#= Append($"{CurrentAssemblyName.Version}") #>")] +public static partial class <#= Model.Name #>Validation +{ + /// Returns a boolean telling whether the value of instance exists in the enumeration. + /// true if the value of instance exists in the enumeration; false otherwise. + public static bool IsDefined(<#= Model.Name #> value) { - /// Returns a boolean telling whether the value of instance exists in the enumeration. - /// true if the value of instance exists in the enumeration; false otherwise. - public static bool IsDefined(<#= Model.Name #> value) + return value switch { - return value switch - { <# foreach (var curr in Model.UniqueValues) { #> - <#= Model.Name #>.<#= curr.MemberName #> => true, + <#= Model.Name #>.<#= curr.MemberName #> => true, <# } #> - _ => false - }; - } + _ => false + }; + } - public static bool IsDefined( - [NotNullWhen(true)] string? name, - StringComparison comparisonType) + public static bool IsDefined( + [NotNullWhen(true)] string? name, + StringComparison comparisonType) + { + return name switch { - return name switch - { <# foreach (var curr in Model.Values) { #> - { } s when s.Equals(nameof(<#= Model.Name #>.<#= curr.MemberName #>), comparisonType) => true, + { } s when s.Equals(nameof(<#= Model.Name #>.<#= curr.MemberName #>), comparisonType) => true, <# } #> - _ => false - }; - } + _ => false + }; + } - public static bool IsDefinedIgnoreCase([NotNullWhen(true)] string? name) - { - return IsDefined(name, StringComparison.OrdinalIgnoreCase); - } + public static bool IsDefinedIgnoreCase([NotNullWhen(true)] string? name) + { + return IsDefined(name, StringComparison.OrdinalIgnoreCase); + } - public static bool IsDefined([NotNullWhen(true)] string? name) + public static bool IsDefined([NotNullWhen(true)] string? name) + { + return name switch { - return name switch - { <# foreach (var curr in Model.Values) { #> - nameof(<#= Model.Name #>.<#= curr.MemberName #>) => true, + nameof(<#= Model.Name #>.<#= curr.MemberName #>) => true, <# } #> - _ => false - }; - } + _ => false + }; } +} <# if (!string.IsNullOrEmpty(Model.Namespace)) { + PopIndent(); #> } <# diff --git a/src/EnumUtilities/Common/CodeWriterBase.cs b/src/EnumUtilities/Common/CodeWriterBase.cs index f7acf64..90c36c8 100644 --- a/src/EnumUtilities/Common/CodeWriterBase.cs +++ b/src/EnumUtilities/Common/CodeWriterBase.cs @@ -9,13 +9,23 @@ namespace Raiqub.Generators.EnumUtilities.Common; /// Represents the base class for code writers. public abstract class CodeWriterBase { + private const char IndentationChar = ' '; + private const int CharsPerIndentation = 4; + private readonly StringBuilder _builder; + private readonly int _charsPerIndentation; + private int _indentation; /// - /// Initializes a new instance of the class with a . + /// Initializes a new instance of the CodeWriterBase class with a StringBuilder. /// - /// The object used for building the template. - protected CodeWriterBase(StringBuilder builder) => _builder = builder; + /// The StringBuilder object used for building the template. + /// The number of characters per indentation level. + protected CodeWriterBase(StringBuilder builder, int charsPerIndentation = CharsPerIndentation) + { + _builder = builder; + _charsPerIndentation = charsPerIndentation; + } /// Gets the name of the current assembly. protected static AssemblyName CurrentAssemblyName { get; } = typeof(CodeWriterBase).Assembly.GetName(); @@ -46,6 +56,7 @@ protected ToStringInstanceHelper ToStringHelper public void GenerateCompilationSource(SourceProductionContext context) { _builder.Clear(); + ClearIndent(); context.AddSource(GetFileName(), SourceText.From(TransformText(), Encoding.UTF8)); } @@ -54,9 +65,34 @@ public void GenerateCompilationSource(SourceProductionContext context) protected void Write(string? textToAppend) { if (string.IsNullOrEmpty(textToAppend)) + { return; + } + + if (_indentation == 0) + { + _builder.Append(textToAppend); + return; + } + + bool endsWithNewline = _builder.Length > 0 && _builder[^1] == '\n'; + bool isFinalLine; + var remainingText = textToAppend.AsSpan(); + while (true) + { + var nextLine = GetNextLine(ref remainingText, out isFinalLine); + + if (endsWithNewline && nextLine.Length > 0) + WriteIndentation(); + + _builder.Append(nextLine); - _builder.Append(textToAppend); + if (isFinalLine) + return; + + _builder.AppendLine(); + endsWithNewline = true; + } } /// Writes the specified interpolated string directly into the generated output. @@ -76,6 +112,12 @@ protected void Write(None none) // Nothing to do } + /// Appends a new line into the generated output. + public void WriteLine() + { + _builder.AppendLine(); + } + /// Write text directly into the generated output and appends a new line. /// The text to be written. public void WriteLine(string textToAppend) @@ -109,6 +151,69 @@ protected None Append([InterpolatedStringHandlerArgument("")] ref WriteInterpola return default; } + /// Increase the indent. + protected void PushIndent() + { + _indentation++; + } + + /// Remove the last indent that was added with . + protected void PopIndent() + { + if (_indentation <= 0) + { + Throw(); + static void Throw() => throw new InvalidOperationException("Indentation is already zeroed"); + } + + _indentation--; + } + + /// Remove any indentation. + protected void ClearIndent() + { + _indentation = 0; + } + + private void WriteIndentation() + { + _builder.Append(IndentationChar, _charsPerIndentation * _indentation); + } + + private static ReadOnlySpan GetNextLine(ref ReadOnlySpan remainingText, out bool isFinalLine) + { + if (remainingText.IsEmpty) + { + isFinalLine = true; + return default; + } + + ReadOnlySpan next; + ReadOnlySpan rest; + + int lineLength = remainingText.IndexOf('\n'); + if (lineLength == -1) + { + lineLength = remainingText.Length; + isFinalLine = true; + rest = default; + } + else + { + rest = remainingText.Slice(lineLength + 1); + isFinalLine = false; + } + + if ((uint)lineLength > 0 && remainingText[lineLength - 1] == '\r') + { + lineLength--; + } + + next = remainingText.Slice(0, lineLength); + remainingText = rest; + return next; + } + protected readonly struct None; protected sealed class ToStringInstanceHelper diff --git a/src/EnumUtilities/EnumUtilities.csproj b/src/EnumUtilities/EnumUtilities.csproj index 411858b..8df372e 100644 --- a/src/EnumUtilities/EnumUtilities.csproj +++ b/src/EnumUtilities/EnumUtilities.csproj @@ -5,6 +5,8 @@ false README.md true + true + $(DefineConstants);AllowUnsafeBlocks diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesExtensions.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesExtensions.g.cs index 9696996..2a235d4 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesExtensions.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesExtensions.g.cs @@ -8,7 +8,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class CategoriesExtensions { /// Converts the value of this instance to its equivalent string representation. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesFactory.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesFactory.g.cs index c2d3602..2eda2d7 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesFactory.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesFactory.g.cs @@ -10,7 +10,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class CategoriesFactory { /// diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesValidation.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesValidation.g.cs index 6386736..181dab7 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesValidation.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.CategoriesValidation.g.cs @@ -9,7 +9,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class CategoriesValidation { /// Returns a boolean telling whether the value of instance exists in the enumeration. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursExtensions.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursExtensions.g.cs index 994daf7..da82b5e 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursExtensions.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursExtensions.g.cs @@ -8,7 +8,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class ColoursExtensions { /// Converts the value of this instance to its equivalent string representation. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursFactory.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursFactory.g.cs index 8b15a34..3147646 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursFactory.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursFactory.g.cs @@ -10,7 +10,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class ColoursFactory { /// diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursValidation.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursValidation.g.cs index d49b111..1185d15 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursValidation.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.ColoursValidation.g.cs @@ -9,7 +9,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class ColoursValidation { /// Returns a boolean telling whether the value of instance exists in the enumeration. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesExtensions.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesExtensions.g.cs index 955c977..84607f3 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesExtensions.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesExtensions.g.cs @@ -8,7 +8,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class HumanStatesExtensions { /// Converts the value of this instance to its equivalent string representation. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesFactory.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesFactory.g.cs index 53dd4ca..1304464 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesFactory.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesFactory.g.cs @@ -10,7 +10,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class HumanStatesFactory { /// diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesValidation.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesValidation.g.cs index 45c9735..2f4123e 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesValidation.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.HumanStatesValidation.g.cs @@ -9,7 +9,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class HumanStatesValidation { /// Returns a boolean telling whether the value of instance exists in the enumeration. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodExtensions.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodExtensions.g.cs index 7669dc1..2296694 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodExtensions.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodExtensions.g.cs @@ -8,7 +8,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class PaymentMethodExtensions { /// Converts the value of this instance to its equivalent string representation. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodFactory.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodFactory.g.cs index f7a42c5..f611a48 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodFactory.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodFactory.g.cs @@ -10,7 +10,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class PaymentMethodFactory { /// diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodValidation.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodValidation.g.cs index 5f20079..e9d77b1 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodValidation.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.PaymentMethodValidation.g.cs @@ -9,7 +9,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class PaymentMethodValidation { /// Returns a boolean telling whether the value of instance exists in the enumeration. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysExtensions.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysExtensions.g.cs index cd1ecf8..5498dca 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysExtensions.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysExtensions.g.cs @@ -8,7 +8,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class WeekDaysExtensions { /// Converts the value of this instance to its equivalent string representation. diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysFactory.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysFactory.g.cs index 92c6d5b..caae506 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysFactory.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysFactory.g.cs @@ -10,7 +10,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class WeekDaysFactory { /// diff --git a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysValidation.g.cs b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysValidation.g.cs index 124e215..18b8c4a 100644 --- a/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysValidation.g.cs +++ b/tests/EnumUtilities.IntegrationTests/Generated/Raiqub.Generators.EnumUtilities/Raiqub.Generators.EnumUtilities.EnumUtilitiesGenerator/Raiqub.Generators.EnumUtilities.IntegrationTests.Models.WeekDaysValidation.g.cs @@ -9,7 +9,7 @@ namespace Raiqub.Generators.EnumUtilities.IntegrationTests.Models { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Raiqub.Generators.EnumUtilities", "1.3.0.0")] public static partial class WeekDaysValidation { /// Returns a boolean telling whether the value of instance exists in the enumeration.