using Microsoft.VisualBasic.CompilerServices; using System; class App { public static void Main(string[] args) { FindType ft = new FindType(); SetOptions(args, ft); ft.Search(); } private static void PrintUsage() { Console.WriteLine(); Console.WriteLine("FindType [SystemOptions] [MatchOptions] [ShowOptions] [MiscOptions] Name"); Console.WriteLine(); Console.WriteLine(" where SystemOptions"); Console.WriteLine(" d:[Directory] - Additional directory to search"); Console.WriteLine(" where MatchOptions"); Console.WriteLine(" x - Name = Exact Type Name (including namespace)"); Console.WriteLine(" n - Name = Namespace "); Console.WriteLine(" w - Match the name anywhere in the namespace"); Console.WriteLine(" where ShowOptions"); Console.WriteLine(" i - Show Interfaces"); Console.WriteLine(" f - Show Fields"); Console.WriteLine(" p - Show Properties"); Console.WriteLine(" e - Show Events"); Console.WriteLine(" m - Show Methods"); Console.WriteLine(" a - Show All Info"); Console.WriteLine(" l - Show Module Information"); Console.WriteLine(" where MiscOptions"); Console.WriteLine(" v = Verbose"); Console.WriteLine(" r = For every type find display base type information"); Console.WriteLine(" ? = Prints Usage information"); Console.WriteLine(); Console.WriteLine("Examples"); Console.WriteLine(); Console.WriteLine(" FindType String"); Console.WriteLine(" Finds all types that have \'String\' as part of their type name\r\n"); Console.WriteLine(" FindType -r String"); Console.WriteLine(" Finds all types that have \'String\' as part of their name"); Console.WriteLine(" and prints out all base classes\r\n"); Console.WriteLine(" FindType -n System.Reflection"); Console.WriteLine(" Displays all types in the \'System.Reflection\' namespace\r\n"); Console.WriteLine(" FindType -xipm System.String"); Console.WriteLine(" Displays the interfaces, properties and methods on the \'System.String\' type\r\n"); Console.WriteLine(" FindType -d:C:\\ -d:\"C:\\Program Files\\Microsoft.NET\\FrameworkSDK\\Lib\" String"); Console.WriteLine(" Searches DLLs C:\\ and C:\\Program Files\\Microsoft.NET\\FrameworkSDK\\Lib"); Console.WriteLine(" as well as in the current directory \r\n"); Console.WriteLine(); } private static void SetOptions(string[] args, FindType ft) { if (args.Length == 0) { PrintUsage(); } else { ft.VerbosePrint = false; int _Vb_t_i4_0 = args.Length - 1; for (int i = 0; i <= _Vb_t_i4_0; i++) { string curArg = args[i]; string backslash = "\\"; if ((curArg.ToCharArray()[0] == '-' | curArg.ToCharArray()[0] == '/') == 0) { ft.ClassAdd(curArg); } else if (Char.ToUpper(curArg.ToCharArray()[1]) != 'D') { int _Vb_t_i4_1 = curArg.ToCharArray().Length - 1; for (int j = 1; j <= _Vb_t_i4_1; j++) { switch (Char.ToUpper(curArg.ToCharArray()[j])) { case 'X': ft.ExactMatchOnly = true; break; case 'R': ft.RecurseTypes = true; break; case 'V': ft.VerbosePrint = true; break; case 'N': ft.MatchOnlyNamespace = true; break; case 'W': ft.WideSearch = true; break; case 'I': ft.ShowInterfaces = true; break; case 'M': ft.ShowMethods = true; break; case 'F': ft.ShowFields = true; break; case 'P': ft.ShowProperties = true; break; case 'E': ft.ShowEvents = true; break; case 'L': ft.ShowModuleInfo = true; break; case 'A': ft.ShowAll(); break; case '?': PrintUsage(); break; case 'D': Console.WriteLine("Directory not specified"); break; default: Console.WriteLine("Invald Option[{0}]", curArg.ToCharArray()[j]); break; } } } else if ((curArg.ToCharArray().Length > 2 & curArg.ToCharArray()[2] == ':') != 0) { string dir = curArg.Substring(3).TrimEnd(backslash.ToCharArray()).ToUpper(); if (StringType.StrCmp(dir, "", false) != 0) { ft.DirAdd(dir); } else { Console.WriteLine("Directory not specified"); } } else { Console.WriteLine("Directory not specified"); } } } } }