Exemplo n.º 1
0
 private static bool TryGetMatchingRestoredCommand(
     RestoredCommandIdentifier restoredCommandIdentifier,
     DirectoryPath nuGetGlobalPackagesFolder,
     CacheRow[] cacheTable,
     out RestoredCommand restoredCommandList)
 {
     (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]
Exemplo n.º 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
     });
 }
Exemplo n.º 3
0
 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)
     });
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 private static bool TryGetMatchingRestoredCommand(
     RestoredCommandIdentifier restoredCommandIdentifier,
     CacheRow[] cacheTable,
     out RestoredCommand restoredCommandList)
 {
     (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]