Example #1
0
        protected override void ProcessPackage(PackageProvider provider, IEnumerable<string> searchKey, SoftwareIdentity package) {

            try {

                base.ProcessPackage(provider, searchKey, package);
            
                // return the object to the caller now.
                WriteObject(package);

                if (IncludeDependencies) {
                    var missingDependencies = new HashSet<string>();
                    foreach (var dep in package.Dependencies) {
                        // note: future work may be needed if the package sources currently selected by the user don't
                        // contain the dependencies.
                        var dependendcies = PackageManagementService.FindPackageByCanonicalId(dep, this);
                        var depPkg = dependendcies.OrderByDescending(pp => pp, SoftwareIdentityVersionComparer.Instance).FirstOrDefault();

                        if (depPkg == null) {
                            missingDependencies.Add(dep);
                            Warning(Constants.Messages.UnableToFindDependencyPackage, dep);
                        } else {
                            ProcessPackage(depPkg.Provider, searchKey.Select(each => each + depPkg.Name).ToArray(), depPkg);
                        }
                    }
                    if (missingDependencies.Any()) {
                        Error(Constants.Errors.UnableToFindDependencyPackage, missingDependencies.JoinWithComma());
                    }
                }
            } catch (Exception ex) {

                Debug("Calling ProcessPackage {0}", ex.ToString());
            }
        }
Example #2
0
        protected override void ProcessPackage(PackageProvider provider, IEnumerable<string> searchKey, SoftwareIdentity package) {

            Debug("Calling ProcessPackage SearchKey = '{0}' and provider name ='{1}'", searchKey, package.ProviderName);
            try {
                base.ProcessPackage(provider, searchKey, package);

                // output to console
                WriteObject(package);

                if (IncludeDependencies) {
                    var missingDependencies = new HashSet<string>();
                    foreach (var dep in package.Dependencies) {
                        var dependendcies = PackageManagementService.FindPackageByCanonicalId(dep, this);
                        var depPkg = dependendcies.OrderByDescending(pp => pp, SoftwareIdentityVersionComparer.Instance).FirstOrDefault();

                        if (depPkg == null) {
                            missingDependencies.Add(dep);
                            Warning(Constants.Messages.UnableToFindDependencyPackage, dep);
                        } else {
                            ProcessPackage(depPkg.Provider, searchKey.Select(each => each + depPkg.Name).ToArray(), depPkg);
                        }
                    }
                    if (missingDependencies.Any()) {
                        Error(Constants.Errors.UnableToFindDependencyPackage, missingDependencies.JoinWithComma());
                    }
                }
            } catch (Exception ex) {
                Debug("Calling ProcessPackage {0}", ex.Message);
            }
        }