コード例 #1
0
        public static void Main(string[] args)
        {
            FindType ft = new FindType();

            SetOptions(args, ft);
            ft.Search();
        }
コード例 #2
0
        // Processes all of the options specified in the arguments
        private static void SetOptions(string[] args, FindType ft)
        {
            if (args.Length == 0)
            {
                PrintUsage();
                return;
            }

            ft.VerbosePrint = false;

            char[] backslash = new char[1];

            backslash[0] = '\\';
            for (int i = 0; i < args.Length; i++)
            {
                string curArg = args[i];

                if (curArg[0] == '-' || curArg[0] == '/')
                {
                    if (Char.ToUpper(curArg[1], CultureInfo.InvariantCulture) == 'D')
                    {
                        if (curArg.Length > 2 && curArg[2] == ':')
                        {
                            String dir = curArg.Substring(3).TrimEnd(backslash).ToUpper(CultureInfo.InvariantCulture);

                            if (dir.Length > 0)
                            {
                                ft.DirAdd(dir);
                            }
                            else
                            {
                                Console.WriteLine("Directory not specified");
                            }
                        }
                        else
                        {
                            Console.WriteLine("Directory not specified");
                        }
                    }
                    else
                    {
                        for (int j = 1; j < curArg.Length; j++)
                        {
                            switch (Char.ToUpper(curArg[j], CultureInfo.InvariantCulture))
                            {
                            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("Invalid Option[{0}]", curArg[j]);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    ft.ClassAdd(curArg);
                }
            }
        }