Frapid.Mapper.Sql.ProcessToken C# (CSharp) Method

ProcessToken() private method

private ProcessToken ( string token ) : string
token string
return string
        private string ProcessToken(string token)
        {
            token = token.Replace(",@", ", @");
            var matches = ParameterPattern.Matches(token);
            int offset = this._parameterTokens.DefaultIfEmpty().Max();
            int count = this._parameterTokens.Count;

            if (count > 0)
            {
                offset++;
            }


            var matchList = new List<int>();
            foreach (Match match in matches)
            {
                string matchValue = match.Value.Replace("@", "");
                int value;

                if (int.TryParse(matchValue, out value))
                {
                    matchList.Add(value);
                }
            }

            foreach (int index in matchList.Distinct().OrderByDescending(x => x))
            {
                int newIndex = offset + index;
                token = ReplaceWord(token, "@" + index, "@" + newIndex);

                this._parameterTokens.Add(newIndex);
            }

            return token;
        }