DirAdd() public method

public DirAdd ( string dir ) : void
dir string
return void
示例#1
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]) == 'D')
                {
                    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");
                    }
                }
                else
                {
                    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
            {
                ft.ClassAdd(curArg);
            }
        }
    }
  // 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]) == 'D')
        {
          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");
        }
        else
        {
          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
      {
        ft.ClassAdd( curArg );
      }
    }
  }