Exemplo n.º 1
0
        private static string GenCnfCode(Type cnfType)
        {
            string className     = GenTBConfigCode.GetCodeClassName(cnfType);
            string classFileName = GenTBConfigCode.GetCodeClassFileName(cnfType);
            string displayName   = cnfType.Name;

            if (AttributeHelper.TryGetTypeAttribute(cnfType, out ConfigAttribute attr))
            {
                displayName = attr.DisplayName;
            }

            string resStr = CnfCode;

            resStr  = Regex.Replace(resStr, "#DISPLAYNAME#", displayName);
            resStr  = Regex.Replace(resStr, "#CLASS#", className);
            resStr  = Regex.Replace(resStr, "#NAME#", classFileName);
            resStr  = Regex.Replace(resStr, "#TYPE#", cnfType.Name);
            resStr  = Regex.Replace(resStr, "#NAME01#", "_" + cnfType.Name);
            resStr  = Regex.Replace(resStr, "#NAME02#", cnfType.Name);
            resStr  = Regex.Replace(resStr, "#NAME03#", ConfigDef.GetCnfNoExName(cnfType.Name));
            resStr += "\n";
            return(resStr);
        }