// Decompiled by Salamander version 1.0.9 // Copyright 2002 Remotesoft Inc. All rights reserved. // http://www.remotesoft.com/salamander using System; using System.Security; class App { public static void Main(string[] args) { FindType ft = new FindType(); try { SetOptions(args, ft); ft.Search(); } catch (SecurityException) { Console.WriteLine("This sample has failed to run due to a security limitation!\nTry running the sample from a local drive or using CasPol.exe to turn off security."); } catch { PrintUsage(); } } 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\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\n"); Console.WriteLine(" FindType -n System.Reflection"); Console.WriteLine(" Displays all types in the \'System.Reflection\' namespace\n"); Console.WriteLine(" FindType -xipm System.String"); Console.WriteLine(" Displays the interfaces, properties and methods on the \'System.String\' type\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 \n"); Console.WriteLine(); } private static void SetOptions(string[] args, FindType ft) { if ((int)args.Length == 0) { PrintUsage(); } else { ft.VerbosePrint = false; char[] backslash = new char[]{'\\'}; for (int i = 0; i < (int)args.Length; i++) { string curArg = args[i]; if (curArg[0] != '-' && curArg[0] != '/') { ft.ClassAdd(curArg); } else if (Char.ToUpper(curArg[1]) != 'D') { for (int j = 1; j < curArg.Length; j++) { switch (Char.ToUpper(curArg[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[j]); break; } } } else if (curArg.Length > 2 && curArg[2] == ':') { string dir = curArg.Substring(3).TrimEnd(backslash).ToUpper(); if (dir != "") { ft.DirAdd(dir); } else { Console.WriteLine("Directory not specified"); } } else { Console.WriteLine("Directory not specified"); } } } } }