private static CommandSearcher.CanDoPathLookupResult CanDoPathLookup(
            string possiblePath)
        {
            CommandSearcher.CanDoPathLookupResult pathLookupResult = CommandSearcher.CanDoPathLookupResult.Yes;
            if (WildcardPattern.ContainsWildcardCharacters(possiblePath))
            {
                pathLookupResult = CommandSearcher.CanDoPathLookupResult.WildcardCharacters;
            }
            else
            {
                try
                {
                    if (Path.IsPathRooted(possiblePath))
                    {
                        pathLookupResult = CommandSearcher.CanDoPathLookupResult.PathIsRooted;
                        goto label_9;
                    }
                }
                catch (ArgumentException ex)
                {
                    pathLookupResult = CommandSearcher.CanDoPathLookupResult.IllegalCharacters;
                    goto label_9;
                }
                if (possiblePath.IndexOfAny(Utils.DirectorySeparators) != -1)
                {
                    pathLookupResult = CommandSearcher.CanDoPathLookupResult.DirectorySeparator;
                }
                else if (possiblePath.IndexOfAny(Path.GetInvalidPathChars()) != -1)
                {
                    pathLookupResult = CommandSearcher.CanDoPathLookupResult.IllegalCharacters;
                }
            }
label_9:
            CommandSearcher.tracer.WriteLine("result = {0}", (object)pathLookupResult);
            return(pathLookupResult);
        }
 private void setupPathSearcher()
 {
     if (this.pathSearcher != null)
     {
         return;
     }
     if ((this.commandResolutionOptions & SearchResolutionOptions.CommandNameIsPattern) != SearchResolutionOptions.None)
     {
         this.canDoPathLookup       = true;
         this.canDoPathLookupResult = CommandSearcher.CanDoPathLookupResult.Yes;
         this.pathSearcher          = new CommandPathSearch((IEnumerable <string>) new Collection <string>()
         {
             this.commandName
         }, this._context.CommandDiscovery.GetLookupDirectoryPaths(), this._context);
     }
     else
     {
         this.canDoPathLookupResult = CommandSearcher.CanDoPathLookup(this.commandName);
         if (this.canDoPathLookupResult == CommandSearcher.CanDoPathLookupResult.Yes)
         {
             this.canDoPathLookup = true;
             this.pathSearcher    = new CommandPathSearch(this.ConstructSearchPatternsFromName(this.commandName), this._context.CommandDiscovery.GetLookupDirectoryPaths(), this._context);
         }
         else if (this.canDoPathLookupResult == CommandSearcher.CanDoPathLookupResult.PathIsRooted)
         {
             this.canDoPathLookup = true;
             string directoryName           = Path.GetDirectoryName(this.commandName);
             Collection <string> collection = new Collection <string>();
             collection.Add(directoryName);
             CommandDiscovery.discoveryTracer.WriteLine("The path is rooted, so only doing the lookup in the specified directory: {0}", (object)directoryName);
             string fileName = Path.GetFileName(this.commandName);
             if (!string.IsNullOrEmpty(fileName))
             {
                 this.pathSearcher = new CommandPathSearch(this.ConstructSearchPatternsFromName(fileName), (IEnumerable <string>)collection, this._context);
             }
             else
             {
                 this.canDoPathLookup = false;
             }
         }
         else
         {
             if (this.canDoPathLookupResult != CommandSearcher.CanDoPathLookupResult.DirectorySeparator)
             {
                 return;
             }
             this.canDoPathLookup = true;
             string str = this.ResolvePSPath(Path.GetDirectoryName(this.commandName));
             CommandDiscovery.discoveryTracer.WriteLine("The path is relative, so only doing the lookup in the specified directory: {0}", (object)str);
             if (str == null)
             {
                 this.canDoPathLookup = false;
             }
             else
             {
                 Collection <string> collection = new Collection <string>();
                 collection.Add(str);
                 string fileName = Path.GetFileName(this.commandName);
                 if (!string.IsNullOrEmpty(fileName))
                 {
                     this.pathSearcher = new CommandPathSearch(this.ConstructSearchPatternsFromName(fileName), (IEnumerable <string>)collection, this._context);
                 }
                 else
                 {
                     this.canDoPathLookup = false;
                 }
             }
         }
     }
 }