using System; namespace AlicizaX.UI.Editor { public interface IUIGeneratorHelper { string GetPrivateComponentByNameRule(string regexName, string componetName, EBindType bindType); string GetPublicComponentByNameRule(string variableName); } public class DefaultUIGeneratorHelper : IUIGeneratorHelper { public string GetPrivateComponentByNameRule(string regexName, string componentName, EBindType bindType) { string endPrefix = bindType == EBindType.ListCom ? "List" : string.Empty; int endNameIndex = componentName.IndexOf( UIGenerateConfiguration.Instance.UIGenerateCommonData.ComCheckEndName, StringComparison.Ordinal); string componentSuffix = endNameIndex >= 0 ? componentName.Substring(endNameIndex + 1) : componentName; return $"m{regexName}{componentSuffix}{endPrefix}"; } public string GetPublicComponentByNameRule(string variableName) { return variableName.Substring(1); } } }