Exemple #1
0
        private bool CreateStruct(ushort id, string name, bool isInternal, out DTOEntry dto)
        {
            int count = this._dtos.Count;

            for (int i = 0; i < count; i++)
            {
                if (this._dtos[i].id == id)
                {
                    dto = this._dtos[i];
                    return(true);
                }
            }
            dto = new DTOEntry(id, name, isInternal);
            this._dtos.Add(dto);
            return(false);
        }
Exemple #2
0
        private string ProcessDTOFuncs(string input)
        {
            StringBuilder sb        = new StringBuilder();
            Match         match     = REGEX_GET_DTO.Match(input);
            string        splitChar = match.Groups[1].Value;

            splitChar = splitChar == "\\n" ? Environment.NewLine : splitChar;

            int c1 = this._dtos.Count;

            for (int j = 0; j < c1; j++)
            {
                DTOEntry dto      = this._dtos[j];
                string   template = match.Groups[2].Value.Replace("[dto_cls_name]", dto.ClsName());
                template = template.Replace("[dto_func_name]", dto.FuncName());

                string content = template;
                content  = this.ProcessFields(content, null);
                content += splitChar;
                sb.Append(content);

                content = template;
                content = this.ProcessFields(content, dto.allFields);
                int c2 = dto.conditions.Count;
                if (c2 > 0)
                {
                    content += splitChar;
                }
                sb.Append(content);

                for (int i = 0; i < c2; i++)
                {
                    content = this.ProcessFields(template, dto.conditions[i].allFields);
                    if (i != c2 - 1)
                    {
                        content += splitChar;
                    }
                    sb.Append(content);
                }
                if (j != c1 - 1)
                {
                    sb.Append(splitChar);
                }
            }
            input = input.Replace(match.Value, sb.ToString());
            return(input);
        }
Exemple #3
0
        private string ProcessDTOs(string input)
        {
            Match  match     = REGEX_DTOS.Match(input);
            string splitChar = match.Groups[1].Value;

            splitChar = splitChar == "\\n" ? Environment.NewLine : splitChar;

            StringBuilder sb    = new StringBuilder();
            int           count = this._dtos.Count;

            for (int i = 0; i < count; i++)
            {
                DTOEntry dto     = this._dtos[i];
                string   content = match.Groups[2].Value.Replace("[dto_cls_name]", dto.ClsName());
                content = content.Replace("[id]", string.Empty + dto.id);
                if (i != count - 1)
                {
                    content += splitChar;
                }
                sb.Append(content);
            }
            return(input.Replace(match.Value, sb.ToString()));
        }