private static bool TryGetMatchingRestoredCommand( RestoredCommandIdentifier restoredCommandIdentifier, DirectoryPath nuGetGlobalPackagesFolder, CacheRow[] cacheTable, out RestoredCommand restoredCommandList) { (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]
public bool TryLoadHighestVersion( RestoredCommandIdentifierVersionRange query, DirectoryPath nuGetGlobalPackagesFolder, out RestoredCommand restoredCommandList) { restoredCommandList = null; string packageCacheFile = GetCacheFile(query.PackageId); if (_fileSystem.File.Exists(packageCacheFile)) { var list = GetCacheTable(packageCacheFile) .Select(c => Convert(query.PackageId, c, nuGetGlobalPackagesFolder)) .Where(strongTypeStored => query.VersionRange.Satisfies(strongTypeStored.restoredCommandIdentifier.Version)) .Where(onlyVersionSatisfies => onlyVersionSatisfies.restoredCommandIdentifier == query.WithVersion(onlyVersionSatisfies.restoredCommandIdentifier.Version)) .OrderByDescending(allMatched => allMatched.restoredCommandIdentifier.Version) .FirstOrDefault(); if (!list.restoredCommand.Equals(default(RestoredCommand))) { restoredCommandList = list.restoredCommand; return(true); } } return(false); }
private static CacheRow ConvertToCacheRow( RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommandList) { return(new CacheRow { Version = restoredCommandIdentifier.Version.ToNormalizedString(), TargetFramework = restoredCommandIdentifier.TargetFramework.GetShortFolderName(), RuntimeIdentifier = restoredCommandIdentifier.RuntimeIdentifier.ToLowerInvariant(), Name = restoredCommandIdentifier.CommandName.Value, Runner = restoredCommandList.Runner, PathToExecutable = restoredCommandList.Executable.Value }); }
private static CacheRow ConvertToCacheRow( RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommandList, DirectoryPath nuGetGlobalPackagesFolder) { return(new CacheRow { Version = restoredCommandIdentifier.Version.ToNormalizedString(), TargetFramework = restoredCommandIdentifier.TargetFramework.GetShortFolderName(), RuntimeIdentifier = restoredCommandIdentifier.RuntimeIdentifier.ToLowerInvariant(), Name = restoredCommandIdentifier.CommandName.Value, Runner = restoredCommandList.Runner, RelativeToNuGetGlobalPackagesFolderPathToDll = Path.GetRelativePath(nuGetGlobalPackagesFolder.Value, restoredCommandList.Executable.Value) }); }
public bool TryLoad( RestoredCommandIdentifier restoredCommandIdentifier, out RestoredCommand restoredCommand) { string packageCacheFile = GetCacheFile(restoredCommandIdentifier.PackageId); if (_fileSystem.File.Exists(packageCacheFile)) { if (TryGetMatchingRestoredCommand( restoredCommandIdentifier, GetCacheTable(packageCacheFile), out restoredCommand)) { return(true); } } restoredCommand = null; return(false); }
Convert( PackageId packageId, CacheRow cacheRow) { RestoredCommandIdentifier restoredCommandIdentifier = new RestoredCommandIdentifier( packageId, NuGetVersion.Parse(cacheRow.Version), NuGetFramework.Parse(cacheRow.TargetFramework), cacheRow.RuntimeIdentifier, new ToolCommandName(cacheRow.Name)); RestoredCommand restoredCommand = new RestoredCommand( new ToolCommandName(cacheRow.Name), cacheRow.Runner, new FilePath(cacheRow.PathToExecutable)); return(restoredCommandIdentifier, restoredCommand); }
Convert( PackageId packageId, CacheRow cacheRow, DirectoryPath nuGetGlobalPackagesFolder) { RestoredCommandIdentifier restoredCommandIdentifier = new RestoredCommandIdentifier( packageId, NuGetVersion.Parse(cacheRow.Version), NuGetFramework.Parse(cacheRow.TargetFramework), cacheRow.RuntimeIdentifier, new ToolCommandName(cacheRow.Name)); RestoredCommand restoredCommand = new RestoredCommand( new ToolCommandName(cacheRow.Name), cacheRow.Runner, nuGetGlobalPackagesFolder .WithFile(cacheRow.RelativeToNuGetGlobalPackagesFolderPathToDll)); return(restoredCommandIdentifier, restoredCommand); }
private static bool TryGetMatchingRestoredCommand( RestoredCommandIdentifier restoredCommandIdentifier, CacheRow[] cacheTable, out RestoredCommand restoredCommandList) { (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]