Ejemplo n.º 1
0
        void AddQuery(List <FileQuery> fileQuery, CommandData cmdArgs)
        {
            var hookCmd = NextOptionForArgument();

            AddQuery(fileQuery, cmdArgs, hookCmd);
        }
Ejemplo n.º 2
0
        public CommandData Parse(string[] args)
        {
            CommandData cmdArgs = new CommandData();

            myArgs = args;

            for (myParseIdx = 0; myParseIdx < args.Length; myParseIdx++)
            {
                string        curArg  = MakeArgLowerCase(args[myParseIdx]);
                List <string> hookCmd = null;

                curArg = TranslateShortToLong(curArg);
                switch (curArg)
                {
                case "corflags":
                    cmdArgs.Command = Commands.CorFlags;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd);
                    break;

                case "cwd":
                    var rootDir = NextOptionForArgument();
                    if (rootDir.Count == 0)
                    {
                        cmdArgs.InvalidComandLineSwitch = "cwd";
                        break;
                    }

                    cmdArgs.Cwd = rootDir[0];
                    break;

                case "diff":
                    cmdArgs.Command = Commands.Diff;
                    DoNotExpectAdditionalParameters(cmdArgs);
                    break;

                case "in":
                    AddQuery(cmdArgs.Queries2, cmdArgs);
                    break;

                case "old":
                    AddQuery(cmdArgs.Queries1, cmdArgs);
                    break;

                case "old2":
                    AddQuery(cmdArgs.OldFiles2, cmdArgs);
                    break;

                case "searchin":
                    AddQuery(cmdArgs.SearchInQuery, cmdArgs);
                    break;

                case "new":
                    AddQuery(cmdArgs.Queries2, cmdArgs);
                    break;

                case "imbalance":
                    cmdArgs.EventSubscriptionImbalance = true;
                    break;

                case "trace":
                    TracerConfig.Reset("console;* Level1");
                    break;

                case WhoUsesMethodCommand.Argument:
                    cmdArgs.Command = Commands.MethodUsage;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }

                    string potentialQuery = hookCmd[0];
                    if (potentialQuery.Contains("("))
                    {
                        cmdArgs.TypeAndInnerQuery = potentialQuery;
                    }
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd.GetRange(1, hookCmd.Count - 1));
                    break;

                case WhoUsesTypeCommand.Argument:
                    cmdArgs.Command = Commands.WhoUsesType;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }

                    cmdArgs.TypeQuery = hookCmd[0];
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd.GetRange(1, hookCmd.Count - 1));
                    break;

                case WhoUsesFieldCommand.Argument:
                    cmdArgs.Command = Commands.WhoUsesField;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    cmdArgs.TypeAndInnerQuery = hookCmd[0];
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd.GetRange(1, hookCmd.Count - 1));
                    break;

                case WhoUsesEventCommand.Argument:
                    cmdArgs.Command = Commands.WhoUsesEvent;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    cmdArgs.TypeAndInnerQuery = hookCmd[0];
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd.GetRange(1, hookCmd.Count - 1));
                    break;

                case WhoImplementsInterfaceCommand.Argument:
                    cmdArgs.Command = Commands.WhoImplementsInterface;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }

                    cmdArgs.TypeQuery = hookCmd[0];
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd.GetRange(1, hookCmd.Count - 1));
                    break;

                case WhoUsesStringConstantCommand.Argument:
                    cmdArgs.Command = Commands.WhoUsesStringConstant;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }

                    cmdArgs.StringConstant = hookCmd[0];
                    if (hookCmd.Count > 1)
                    {
                        AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd.GetRange(1, hookCmd.Count - 1));
                    }
                    break;

                case "word":
                    cmdArgs.WordMatch = true;
                    break;

                case "case":
                    cmdArgs.CaseSensitiveMatch = true;
                    break;

                case GetFileInfoCommand.Argument:
                    cmdArgs.Command = Commands.GetFileInfo;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd);
                    break;

                case "whoreferences":
                    cmdArgs.Command = Commands.WhoReferences;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    AddQuery(cmdArgs.Queries1, cmdArgs, hookCmd);
                    break;

                case "getpdbs":
                    cmdArgs.Command = Commands.DownloadPdbs;
                    hookCmd         = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    AddQuery(cmdArgs.Queries1, cmdArgs, new List <string> {
                        hookCmd[0]
                    });
                    if (hookCmd.Count > 1)
                    {
                        cmdArgs.PdbDownloadDir = hookCmd[1];
                    }
                    if (hookCmd.Count > 2)
                    {
                        cmdArgs.InvalidComandLineSwitch = String.Format("The argument {0} is not valid for this command", hookCmd[2]);
                    }
                    break;

                case "showrebuildtargets":
                    cmdArgs.Command = Commands.ShowRebuildTargets;
                    DoNotExpectAdditionalParameters(cmdArgs);
                    break;

                case "showstrongname":
                    cmdArgs.Command = Commands.ShowStrongName;
                    AddQuery(cmdArgs.Queries1, cmdArgs);
                    break;

                case "showreferences":
                    cmdArgs.Command = Commands.ShowReferences;
                    AddQuery(cmdArgs.Queries1, cmdArgs);
                    break;

                case "verbose":
                    cmdArgs.Verbose = true;
                    break;

                case "excel":
                    cmdArgs.OutputToExcel = true;
                    hookCmd = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    cmdArgs.ExcelOutputFileName = hookCmd[0];
                    break;

                case "threads":
                    hookCmd = NextOptionForArgument();
                    if (hookCmd.Count == 0)
                    {
                        break;
                    }
                    int newThreadCount = 0;
                    if (int.TryParse(hookCmd[0], out newThreadCount) && newThreadCount > 0)
                    {
                        cmdArgs.ThreadCount = newThreadCount;
                    }
                    else
                    {
                        cmdArgs.InvalidComandLineSwitch = hookCmd[0];
                    }
                    break;

                case "fileinfo":
                    cmdArgs.WithFileInfo = true;
                    break;

                default:
                    cmdArgs.UnknownCommandLineSwitch = curArg;
                    break;
                }
            }

            return(cmdArgs);
        }
Ejemplo n.º 3
0
 public QueryCommandBase(CommandData parsedArgs)
     : base(parsedArgs)
 {
 }
 public WhoImplementsInterfaceCommand(CommandData parsedArgs)
     : base(parsedArgs)
 {
     AddAdditionalColumnsWhenEnabled(myResultHeader);
 }
Ejemplo n.º 5
0
 public NoneCommand(CommandData parsedArgs)
     : base(parsedArgs)
 {
 }
Ejemplo n.º 6
0
 public ShowStrongNameCommand(CommandData parsedArgs)
     : base(parsedArgs)
 {
 }