Exemple #1
0
        private static MatchFunction GetMatchFunction(MethodForm methodForm)
        {
            MatchFunction matchFunction;

            switch (methodForm)
            {
            case MethodForm.Getter:
                matchFunction = new MatchFunction(RegexUtils.MatchGetPropertyName);
                break;

            case MethodForm.Setter:
                matchFunction = new MatchFunction(RegexUtils.MatchSetPropertyName);
                break;

            default:
                matchFunction = null;
                break;
            }

            return(matchFunction.RequiredNotNull());
        }
Exemple #2
0
        private PropertyMember MatchToPropertyMember(string name, string fullName, MatchFunction matchFunction)
        {
            try
            {
                var accessedMemberName = matchFunction.MatchNameFunction(name);
                if (accessedMemberName != null)
                {
                    var foundNameMatches = _type.GetPropertyMembersWithName(accessedMemberName).SingleOrDefault();
                    if (foundNameMatches != null)
                    {
                        return(foundNameMatches);
                    }
                }
            }
            catch (InvalidOperationException)
            {
            }

            var accessedMemberFullName = matchFunction.MatchNameFunction(fullName);

            return(accessedMemberFullName != null
                ? GetPropertyMemberWithFullNameEndingWith(_type, accessedMemberFullName)
                : null);
        }