public static List <EnumDeclarationSyntax> SearchForEnum(EnumMatch enumMatch) { if (Program.Debug) { Program.WriteLine(ConsoleColor.Yellow, $"Trying to find {{{UsingDirective.BuildFullTypeTag(enumMatch)}}}"); Program.IndentLevel++; } List <EnumDeclarationSyntax> ls = Registry.GetMatchedType(enumMatch); if (!Program.SkipOne) { ls = Registry.AssemblyCs.Values.Where(c => c is EnumDeclarationSyntax e && enumMatch.Matches(e)) .Cast <EnumDeclarationSyntax>().ToList(); } foreach (var enumDeclarationSyntax in ls) { Registry.AddMatchedType(enumMatch, enumDeclarationSyntax); } if (Program.Debug) { Program.IndentLevel--; } return(ls); }
public static List <ClassDeclarationSyntax> SearchForClass(ClassMatch classMatch) { if (Program.Debug) { Program.WriteLine(ConsoleColor.Yellow, $"Trying to find {{{UsingDirective.BuildFullTypeTag(classMatch)}}}"); Program.IndentLevel++; } List <ClassDeclarationSyntax> ls = Registry.GetMatchedType(classMatch); if (!Program.SkipOne) { ls = Registry.AssemblyCs.Values.Where(c => c is ClassDeclarationSyntax cl && classMatch.Matches(cl)) .Cast <ClassDeclarationSyntax>().ToList(); } List <ClassDeclarationSyntax> toRemove = new(); foreach (var classDeclarationSyntax in ls) { if (Registry.Fullmatches.Contains(classDeclarationSyntax)) { toRemove.Add(classDeclarationSyntax); } else { Registry.AddMatchedType(classMatch, classDeclarationSyntax); } } foreach (var torm in toRemove) { ls.Remove(torm); } if (ls.Count == 1) { Registry.Fullmatches.Add(ls[0]); } if (Program.Debug) { Program.IndentLevel--; } return(ls); }
public static void DisplayMatches <T>(TypeMatchBase <T> name, IEnumerable <T> cl) where T : BaseTypeDeclarationSyntax { DisplayMatchesString(name, UsingDirective.BuildFullTypeTag(name), cl.Select(UsingDirective.BuildFullTypeName).ToList()); }