示例#1
0
        internal IEnumerable <string> GetLookupDirectoryPaths()
        {
            LookupPathCollection lookupPathCollection = new LookupPathCollection();
            string environmentVariable = Environment.GetEnvironmentVariable("PATH");

            CommandDiscovery.discoveryTracer.WriteLine("PATH: {0}", (object)environmentVariable);
            if (environmentVariable == null || !string.Equals(this.pathCacheKey, environmentVariable, StringComparison.OrdinalIgnoreCase) || this.cachedPath == null)
            {
                this.cachedLookupPaths = (LookupPathCollection)null;
                this.pathCacheKey      = environmentVariable;
                if (this.pathCacheKey != null)
                {
                    string[] strArray = this.pathCacheKey.Split(new char[1]
                    {
                        ';'
                    }, StringSplitOptions.RemoveEmptyEntries);
                    if (strArray != null)
                    {
                        this.cachedPath = new Collection <string>();
                        foreach (string str1 in strArray)
                        {
                            string str2 = str1.TrimStart();
                            this.cachedPath.Add(str2);
                            lookupPathCollection.Add(str2);
                        }
                    }
                }
            }
            else
            {
                lookupPathCollection.AddRange((ICollection <string>) this.cachedPath);
            }
            if (this.cachedLookupPaths == null)
            {
                this.cachedLookupPaths = lookupPathCollection;
            }
            return((IEnumerable <string>) this.cachedLookupPaths);
        }