/// <summary> /// Transforms the value. /// </summary> private string Transform(string transform, string value) { if (string.IsNullOrEmpty(transform) || string.IsNullOrEmpty(value)) { return(value); } return((transform.ToUpperInvariant()) switch { #pragma warning disable CA1308 // This is an intended "to lower" action. "TOLOWERCASE" => value.ToLowerInvariant(), #pragma warning restore CA1308 "TOUPPERCASE" => value.ToUpperInvariant(), "TOPRIVATECASE" => CodeGenerator.ToPrivateCase(value), "TOARGUMENTCASE" => CodeGenerator.ToCamelCase(value), "TOSENTENCECASE" => CodeGenerator.ToSentenceCase(value), "TOPASCALCASE" => CodeGenerator.ToPascalCase(value), "TOCAMELCASE" => CodeGenerator.ToCamelCase(value), "TOSNAKECASE" => CodeGenerator.ToSnakeCase(value), "TOKEBABCASE" => CodeGenerator.ToKebabCase(value), "TOPLURAL" => CodeGenerator.ToPlural(value), "TOCOMMENTS" => CodeGenerator.ToComments(value), "TOSEECOMMENTS" => CodeGenerator.ToSeeComments(value), _ => throw new CodeGenException($"Transform operation {transform} is not valid.", _xmlCurrent.ToString()), });
/// <summary> /// Trasforms the value. /// </summary> private string Transform(string transform, string value) { if (string.IsNullOrEmpty(transform) || string.IsNullOrEmpty(value)) { return(value); } switch (transform.ToLower()) { case "tolowercase": return(value.ToLower()); case "touppercase": return(value.ToUpper()); case "toprivatecase": return(CodeGenerator.ToPrivateCase(value)); case "toargumentcase": return(CodeGenerator.ToCamelCase(value)); case "tosentencecase": return(CodeGenerator.ToSentenceCase(value)); case "topascalcase": return(CodeGenerator.ToPascalCase(value)); case "tocamelcase": return(CodeGenerator.ToCamelCase(value)); case "tosnakecase": return(CodeGenerator.ToSnakeCase(value)); case "tokebabcase": return(CodeGenerator.ToKebabCase(value)); case "toplural": return(CodeGenerator.ToPlural(value)); case "tocomments": return(CodeGenerator.ToComments(value)); case "toseecomments": return(CodeGenerator.ToSeeComments(value)); default: throw new CodeGenException($"Transform operation {transform} is not valid.", _xmlCurrent.ToString()); } }