Ejemplo n.º 1
0
        private int Execute(IPackage package, IPackageOperationResolver resolver)
        {
            var packagesToMirror = resolver.ResolveOperations(package)
                                   .Where(o => o.Action == PackageAction.Install)
                                   .Select(o => o.Package)
                                   .ToList();

            int countMirrored = 0;

            foreach (var p in packagesToMirror)
            {
                if (TargetRepository.Exists(package))
                {
                    Logger.Log(MessageLevel.Info, NuGetResources.Log_PackageAlreadyPresent, p.GetFullName(), TargetRepository.Source);
                }
                else
                {
                    ExecuteMirror(p);
                    countMirrored++;
                    Logger.Log(MessageLevel.Info, NuGetResources.Log_PackageMirroredSuccessfully, p.GetFullName(), TargetRepository.Source);
                }
            }

            return(countMirrored);
        }
Ejemplo n.º 2
0
        private bool Execute(IPackage package, IPackageOperationResolver resolver)
        {
            var packagesToMirror = resolver.ResolveOperations(package)
                                   .Where(o => o.Action == PackageAction.Install)
                                   .Select(o => o.Package)
                                   .ToList();

            bool mirrored = false;

            foreach (var p in packagesToMirror)
            {
                if (TargetRepository.Exists(package))
                {
                    Logger.Log(MessageLevel.Info, NuGetResources.Log_PackageAlreadyPresent, p.GetFullName(), TargetRepository.Source);
                }
                else
                {
                    ExecuteMirror(p);
                    mirrored = true;
                }
            }

            if (mirrored)
            {
                Logger.Log(MessageLevel.Info, NuGetResources.Log_PackageAlreadyPresent, package.GetFullName(), TargetRepository.Source);
            }
            return(mirrored);
        }