Ejemplo n.º 1
0
        public static List <MethodDeclarationSyntax> SearchForMethod(this ClassDeclarationSyntax classDeclaration,
                                                                     MethodMatch methodMatch)
        {
            if (Program.Debug)
            {
                Program.WriteLine(ConsoleColor.Yellow, $"Trying to find {{{UsingDirective.BuildFullMemberTag(methodMatch)}}}");
                Program.IndentLevel++;
            }

            List <MethodDeclarationSyntax> s = Registry.GetMatchedMember(methodMatch);

            if (!Program.SkipOne)
            {
                Program.WriteLine(ConsoleColor.Red, "Skipping for speed");
                s = classDeclaration.Members.OfType <MethodDeclarationSyntax>().Where(methodMatch.Matches)
                    .ToList();
            }

            if (Program.Debug)
            {
                Program.IndentLevel--;
            }

            return(s);
        }
Ejemplo n.º 2
0
        public static List <FieldDeclarationSyntax> SearchForField(this ClassDeclarationSyntax type, FieldMatch fieldMatch)
        {
            if (Program.Debug)
            {
                Program.WriteLine(ConsoleColor.Yellow, $"Trying to find {{{UsingDirective.BuildFullMemberTag(fieldMatch)}}}");
                Program.IndentLevel++;
            }

            List <FieldDeclarationSyntax> s = Registry.GetMatchedMember(fieldMatch);

            if (!Program.SkipOne)
            {
                s = type.Members.OfType <FieldDeclarationSyntax>().Where(fieldMatch.Matches)
                    .ToList();
            }


            if (Program.Debug)
            {
                Program.IndentLevel--;
            }

            return(s);
        }
Ejemplo n.º 3
0
        public static List <EnumMemberDeclarationSyntax> SearchForEnumValue(this EnumDeclarationSyntax enumDeclaration,
                                                                            EnumValueMatch valueMatch)
        {
            if (Program.Debug)
            {
                Program.WriteLine(ConsoleColor.Yellow, $"Trying to find {{{UsingDirective.BuildFullMemberTag(valueMatch)}}}");
                Program.IndentLevel++;
            }

            List <EnumMemberDeclarationSyntax> s = Registry.GetMatchedMember(valueMatch);

            if (!Program.SkipOne)
            {
                s = enumDeclaration.Members.Where(m => valueMatch.Matches(m))
                    .ToList();
            }

            if (Program.Debug)
            {
                Program.IndentLevel--;
            }

            return(s);
        }
Ejemplo n.º 4
0
 public static void DisplayMatches <T, TU>(MemberMatchBase <T, TU> name, IEnumerable <MemberDeclarationSyntax> cl)
     where T : MemberDeclarationSyntax where TU : BaseTypeDeclarationSyntax
 {
     DisplayMatchesString(name, UsingDirective.BuildFullMemberTag(name),
                          cl.Select(UsingDirective.BuildFullMemberName).ToList());
 }