コード例 #1
0
 private static bool TryGetMatchingRestoredCommand(
     RestoredCommandIdentifier restoredCommandIdentifier,
     DirectoryPath nuGetGlobalPackagesFolder,
     CacheRow[] cacheTable,
     out RestoredCommand restoredCommandList)
 {
     (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]
コード例 #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
     });
 }
コード例 #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)
     });
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #7
0
 private static bool TryGetMatchingRestoredCommand(
     RestoredCommandIdentifier restoredCommandIdentifier,
     CacheRow[] cacheTable,
     out RestoredCommand restoredCommandList)
 {
     (RestoredCommandIdentifier restoredCommandIdentifier, RestoredCommand restoredCommand)[]