예제 #1
0
        public static PackageIndex Load(IEnumerable <string> packageIndexFiles)
        {
            string indexKey = String.Join("|", packageIndexFiles);

            PackageIndex result = null;

            if (s_indexCache.TryGetValue(indexKey, out result))
            {
                return(result);
            }

            foreach (var packageIndexFile in packageIndexFiles)
            {
                if (result == null)
                {
                    result = Load(packageIndexFile);
                }
                else
                {
                    result.Merge(packageIndexFile);
                }
            }

            s_indexCache[indexKey] = result;

            return(result);
        }
예제 #2
0
        public static PackageIndex Load(IEnumerable <string> packageIndexFiles)
        {
            string indexKey = String.Join("|",
                                          packageIndexFiles.Select(packageIndexFile => new FileInfo(packageIndexFile))
                                          .Select(packageIndexFileInfo => $"{packageIndexFileInfo.FullName}:{packageIndexFileInfo.Length}:{packageIndexFileInfo.LastWriteTimeUtc.Ticks}"));

            PackageIndex result = null;

            if (s_indexCache.TryGetValue(indexKey, out result))
            {
                return(result);
            }

            foreach (var packageIndexFile in packageIndexFiles)
            {
                if (result == null)
                {
                    result = Load(packageIndexFile);
                }
                else
                {
                    result.Merge(packageIndexFile);
                }
            }

            s_indexCache[indexKey] = result;

            return(result);
        }