private string AddProperty(string file, IPropertyAdditionOptions options, bool forInterface) { StringEditor stringEditor = new StringEditor(file); FindStartingLineForNewProperty(file, options, stringEditor); if (!stringEditor.GetLine().Contains("}")) { stringEditor.Prev(); } if (ContainsProperty(file)) { stringEditor.InsertNewLine(); } if (forInterface) { stringEditor.InsertLine(BackendDtoInterfacePropertyLine.GetPropertyLine(options)); } else { stringEditor.InsertLine(BackendDtoPropertyLine.GetPropertyLine(options)); } return(stringEditor.GetText()); }
private string AddProperty(string file, IPropertyAdditionOptions options) { StringEditor stringEditor = new StringEditor(file); FindStartingLineForNewProperty(file, options, stringEditor); if (!stringEditor.GetLine().Contains("}")) { stringEditor.Prev(); } if (ContainsProperty(file)) { stringEditor.InsertNewLine(); } if (!options.IsOptional) { stringEditor.InsertLine(" [Required]"); } if (options.PropertyType == PropertyTypes.String && options.PropertyTypeExtra != null) { stringEditor.InsertLine($" [StringLength({options.PropertyTypeExtra})]"); } stringEditor.InsertLine(BackendDtoPropertyLine.GetPropertyLine(options)); return(stringEditor.GetText()); }