private static bool TryGetMatchingRestoredCommand(
     RestoredCommandIdentifier restoredCommandIdentifier,
     DirectoryPath nuGetGlobalPackagesFolder,
     CacheRow[] cacheTable,
     out RestoredCommand restoredCommandList)
 {
     (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]
Example #2
0
 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)
     });
 }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #7
0
 private static bool TryGetMatchingRestoredCommand(
     RestoredCommandIdentifier restoredCommandIdentifier,
     CacheRow[] cacheTable,
     out RestoredCommand restoredCommandList)
 {
     (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]