Esempio n. 1
0
        public void SetupCompatibleDriver(string workingDirectory, IDriverConfig browserConfig, string browserVersion, bool use32bit = true, WDMProxy proxy = null)
        {
            var driverArchitecture = use32bit ? Architecture.X32 : ArchitectureHelper.GetArchitecture();

            List <Tuple <string, string> > driverInfo;

            driverInfo = GetDriverInfo(browserConfig, driverArchitecture, browserVersion);

            //these are all the variables we need to be setup
            var url            = driverInfo[0].Item1;
            var driverLocation = Path.Combine(workingDirectory, driverInfo[0].Item2);


            if (File.Exists(driverLocation))
            {
                SetUpLocalDriver(driverLocation);
            }
            else
            {
                var tempDirectory      = FileHelper.GetTempDirectory();
                var driverName         = browserConfig.GetBinaryName();
                var downloadedFileName = FileHelper.GetFileNameFromUrl(url);

                var zipLocation = ZipHelper.DownloadZip(url, tempDirectory, downloadedFileName, proxy);

                FileHelper.CreateDestinationDirectory(driverLocation);

                ZipHelper.UnZipToDriverLocation(zipLocation, driverLocation, driverName);

                ZipHelper.DeleteZip(zipLocation);

                SetUpLocalDriver(driverLocation);
            }
        }
        /// <summary>
        /// This method use the ArchitectureHelper.GetArchitecture() to get the system's Architecture
        /// and return the name of the folder that needed to be used
        /// </summary>
        /// <returns>string foldersName</returns>
        private static string GetArchitectureNameFolder()
        {
            // Declare a new string, to hold the folder's name
            string folderName = null;

            // Switch the enum Architecture
            switch (ArchitectureHelper.GetArchitecture())
            {
            // Case 32 bits
            case Architecture.Architecture.x86:
                folderName = "32 bit";
                break;

            // Case 64 bits
            case Architecture.Architecture.x64:
                folderName = "64 bit";
                break;

            // Another case
            default:
                break;
            }

            // Return the folder names
            return(folderName);
        }
Esempio n. 3
0
        private void GetDependenciesRecursive(List <IPackageRepository> repositories, PackageDependency dependency, CpuArchitecture packageArchitecture, string OS)
        {
            if (Dependencies.Any(p => (p.Name == dependency.Name) &&
                                 dependency.Version.IsCompatible(p.Version) &&
                                 ArchitectureHelper.PluginsCompatible(p.Architecture, packageArchitecture)))
            {
                return;
            }
            PackageDef depPkg = GetPackageDefFromInstallation(dependency.Name, dependency.Version);

            if (depPkg == null)
            {
                depPkg = GetPackageDefFromRepo(repositories, dependency.Name, dependency.Version);
                MissingDependencies.Add(depPkg);
            }
            if (depPkg == null)
            {
                UnknownDependencies.Add(dependency);
                return;
            }
            Dependencies.Add(depPkg);
            foreach (var nextLevelDep in depPkg.Dependencies)
            {
                GetDependenciesRecursive(repositories, nextLevelDep, packageArchitecture, OS);
            }
        }
 public static string DriverDirectoryFullPath(this IDriverConfig driverConfig)
 {
     if (driverConfig == null)
     {
         throw new ArgumentNullException(nameof(driverConfig));
     }
     return(Path.Combine(Environment.CurrentDirectory,
                         driverConfig.GetName(), driverConfig.GetLatestVersion(),
                         $"{ArchitectureHelper.GetArchitecture():F}"));
 }
Esempio n. 5
0
        public void SetUpDriver(IDriverConfig config, string version = "Latest",
                                Architecture architecture            = Architecture.Auto)
        {
            architecture = architecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : architecture;
            version      = version.Equals("Latest") ? config.GetLatestVersion() : version;
            var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();

            url = UrlHelper.BuildUrl(url, version);
            var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
                                                          config.GetBinaryName());

            SetUpDriver(url, binaryPath, config.GetBinaryName());
        }
Esempio n. 6
0
        /// <summary>
        /// Downloads driver from repo
        /// </summary>
        /// <param name="type">Driver type</param>
        /// <param name="version">Version number</param>
        /// <returns>Path of driver location</returns>
        private static string GetDriverVersion(DriverFactory.DriverTypes type, string version = "")
        {
            string       driverFullPath      = "";
            string       executingPath       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
            string       binaryName          = "";
            string       url                 = "";
            string       latestVersionNumber = version == "" ? GetLatestVersionNumber(type) : version;
            Architecture currnetArchitecture = ArchitectureHelper.GetArchitecture();

            switch (type)
            {
            case DriverFactory.DriverTypes.Chrome:
                ChromeConfig cConfig = new ChromeConfig();
                binaryName = cConfig.GetBinaryName();
                url        = currnetArchitecture == Architecture.X32 ? cConfig.GetUrl32() : cConfig.GetUrl64();
                url        = UrlHelper.BuildUrl(url, latestVersionNumber);
                break;

            case DriverFactory.DriverTypes.Firefox:
                FirefoxConfig fConfig = new FirefoxConfig();
                binaryName = fConfig.GetBinaryName();
                url        = currnetArchitecture == Architecture.X32 ? fConfig.GetUrl32() : fConfig.GetUrl64();
                url        = UrlHelper.BuildUrl(url, latestVersionNumber);
                break;

            case DriverFactory.DriverTypes.IE:
                InternetExplorerConfig ieConfig = new InternetExplorerConfig();
                binaryName = ieConfig.GetBinaryName();
                url        = currnetArchitecture == Architecture.X32 ? ieConfig.GetUrl32() : ieConfig.GetUrl64();
                url        = UrlHelper.BuildUrl(url, latestVersionNumber);
                break;

            default:
                break;
            }
            string driverLocationPath = version == "" ? Path.Combine(executingPath, type.ToString())
                                                      : Path.Combine(Path.Combine(executingPath, type.ToString()), version);

            driverFullPath = Path.Combine(driverLocationPath, binaryName);

            if (!IsLocalVersionLatestVersion(type, driverLocationPath, version))
            {
                if (File.Exists(driverFullPath))
                {
                    File.Delete(driverFullPath);
                }

                new Manager.DriverManager().SetUpDriver(url, driverFullPath, binaryName);
            }
            return(driverLocationPath);
        }
 public void SetUpDriver(IDriverConfig config, string version = VersionResolveStrategy.Latest,
                         Architecture architecture            = Architecture.Auto)
 {
     lock (Object)
     {
         architecture = architecture.Equals(Architecture.Auto)
             ? ArchitectureHelper.GetArchitecture()
             : architecture;
         version = GetVersionToDownload(config, version);
         var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();
         url = UrlHelper.BuildUrl(url, version);
         var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
                                                       config.GetBinaryName());
         SetUpDriver(url, binaryPath, config.GetBinaryName());
     }
 }
Esempio n. 8
0
        /// <summary>
        /// True if this package is compatible (can be installed on) the specified operating system and architecture
        /// </summary>
        /// <param name="pkg"></param>
        /// <param name="selectedArch">Specifies a CPU architecture. If unspecified, the current host architecture is used.</param>
        /// <param name="selectedOS">Specifies an operating system. If null, the current host operating system is used.</param>
        /// <returns></returns>
        public static bool IsPlatformCompatible(this IPackageIdentifier pkg, CpuArchitecture selectedArch = CpuArchitecture.Unspecified, string selectedOS = null)
        {
            var cpu = selectedArch == CpuArchitecture.Unspecified ? ArchitectureHelper.GuessBaseArchitecture : selectedArch;
            var os  = selectedOS ?? RuntimeInformation.OSDescription;

            if (ArchitectureHelper.CompatibleWith(cpu, pkg.Architecture) == false)
            {
                return(false);
            }

            if (IsOsCompatible(pkg, os) == false)
            {
                return(false);
            }

            return(true);
        }
        private static void SetUpDriver(IDriverConfig driverConfig, IDriverSettings driverSettings)
        {
            var architecture = driverSettings.SystemArchitecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : driverSettings.SystemArchitecture;
            var version      = driverSettings.WebDriverVersion.Equals(VersionResolveStrategy.Latest) ? driverConfig.GetLatestVersion() : driverSettings.WebDriverVersion;

            version = version.Equals(VersionResolveStrategy.MatchingBrowser) ? driverConfig.GetMatchingBrowserVersion() : version;
            var url        = UrlHelper.BuildUrl(architecture.Equals(Architecture.X32) ? driverConfig.GetUrl32() : driverConfig.GetUrl64(), version);
            var binaryPath = FileHelper.GetBinDestination(driverConfig.GetName(), version, architecture, driverConfig.GetBinaryName());

            if (!File.Exists(binaryPath) || !Environment.GetEnvironmentVariable("PATH").Contains(binaryPath))
            {
                lock (WebDriverDownloadingLock)
                {
                    new DriverManager().SetUpDriver(url, binaryPath, driverConfig.GetBinaryName());
                }
            }
        }
Esempio n. 10
0
        public ComputerModel GetAllData()
        {
            CpuModel[] cpus = null;
            try
            {
                var cpusProperties = devicePropertiesAdapter.GetMultipleProperties("Win32_Processor");

                cpus = cpusProperties.Select(cp =>
                {
                    var cpu = new CpuModel()
                    {
                        Specification = cp["Name"].ToString() ?? "Unknown",
                        CpuClocks     = new CpuClocks()
                        {
                            CoreSpeed = cp["CurrentClockSpeed"] != null ? Convert.ToSingle((uint)(cp["CurrentClockSpeed"])) : 0f,
                            BusSpeed  = cp["ExtClock"] != null ? Convert.ToSingle((uint)(cp["ExtClock"])) : 0f,
                        },
                        NumberOfCores             = cp["NumberOfCores"] != null ? (uint)(cp["NumberOfCores"]) : 1,
                        NumberOfLogicalProcessors = cp["NumberOfLogicalProcessors"] != null ? (uint)(cp["NumberOfLogicalProcessors"]) : 1,
                        Architecture = ArchitectureHelper.GetArchitecture((ushort)cp["Architecture"], (ushort)cp["DataWidth"]),
                        Manufacturer = cp["Manufacturer"]?.ToString()
                    };
                    cpu = SetModelFamilyStepping(cpu, cp["Caption"].ToString());

                    SetSupportedInstructions(cpu, (ushort)cp["Architecture"]);

                    SetCaches(cpu);

                    SetCpuDetails(cpu);
                    return(cpu);
                }).ToArray();

                WindowsProcessor.GetSupportedInstructions();
            }
            finally
            {
                if (cpus == null || cpus.Length == 0)
                {
                    cpus = new CpuModel[] { new CpuModel()
                                            {
                                                CpuClocks = new CpuClocks()
                                                {
                                                },
                                                Caches = new CpuCaches()
                                                {
                                                    Level1Data         = new CpuCacheItem(),
                                                    Level1Instructions = new CpuCacheItem(),
                                                    Level2             = new CpuCacheItem(),
                                                    Level3             = new CpuCacheItem()
                                                },
                                                CpuFamilyModelStepping = new CpuFamilyModelStepping()
                                                {
                                                }
                                            }, };
                }
            }


            return(new ComputerModel()
            {
                Cpus = new AllCpus()
                {
                    Cpus = cpus,
                    RootCpu = cpus[0],
                    TotalOfCores = cpus.Length > 1 ? (uint)cpus.Sum(c => c.NumberOfCores) : cpus[0].NumberOfCores,
                    TotalOfLogicalProcessors = cpus.Length > 1 ? (uint)cpus.Sum(c => c.NumberOfLogicalProcessors) : cpus[0].NumberOfLogicalProcessors,
                }
            });
        }
Esempio n. 11
0
        internal static List <PackageDef> GatherPackagesAndDependencyDefs(Installation installation, PackageSpecifier[] pkgRefs, string[] packageNames, string Version, CpuArchitecture arch, string OS, List <IPackageRepository> repositories, bool force, bool includeDependencies, bool askToIncludeDependencies, bool noDowngrade)
        {
            List <PackageDef> gatheredPackages = new List <PackageDef>();

            List <PackageSpecifier> packages = new List <PackageSpecifier>();

            if (pkgRefs != null)
            {
                packages = pkgRefs.ToList();
            }
            else
            {
                if (packageNames == null)
                {
                    throw new Exception("No packages specified.");
                }
                foreach (string packageName in packageNames)
                {
                    var version = Version;
                    if (Path.GetExtension(packageName).ToLower().EndsWith("tappackages"))
                    {
                        var tempDir          = Path.GetTempPath();
                        var bundleFiles      = PluginInstaller.UnpackPackage(packageName, tempDir);
                        var packagesInBundle = bundleFiles.Select(PackageDef.FromPackage);

                        // A packages file may contain the several variants of the same package, try to select one based on OS and Architecture
                        foreach (IGrouping <string, PackageDef> grp in packagesInBundle.GroupBy(p => p.Name))
                        {
                            var selected = grp.ToList();
                            if (selected.Count == 1)
                            {
                                gatheredPackages.Add(selected.First());
                                continue;
                            }
                            if (!string.IsNullOrEmpty(OS))
                            {
                                selected = selected.Where(p => p.OS.ToLower().Split(',').Any(OS.ToLower().Contains)).ToList();
                                if (selected.Count == 1)
                                {
                                    gatheredPackages.Add(selected.First());
                                    log.Debug("TapPackages file contains packages for several operating systems. Picking only the one for {0}.", OS);
                                    continue;
                                }
                            }
                            if (arch != CpuArchitecture.Unspecified)
                            {
                                selected = selected.Where(p => ArchitectureHelper.CompatibleWith(arch, p.Architecture)).ToList();
                                if (selected.Count == 1)
                                {
                                    gatheredPackages.Add(selected.First());
                                    log.Debug("TapPackages file contains packages for several CPU architectures. Picking only the one for {0}.", arch);
                                    continue;
                                }
                            }
                            throw new Exception("TapPackages file contains multiple variants of the same package. Unable to autoselect a suitable one.");
                        }
                    }
                    else if (string.IsNullOrWhiteSpace(packageName) == false)
                    {
                        packages.Add(new PackageSpecifier(packageName, VersionSpecifier.Parse(version ?? ""), arch, OS));
                    }
                }
            }

            foreach (var packageReference in packages)
            {
                var       installedPackages = installation.GetPackages();
                Stopwatch timer             = Stopwatch.StartNew();
                if (File.Exists(packageReference.Name))
                {
                    var package = PackageDef.FromPackage(packageReference.Name);

                    if (noDowngrade)
                    {
                        var installedPackage = installedPackages.FirstOrDefault(p => p.Name == package.Name);
                        if (installedPackage != null && installedPackage.Version.CompareTo(package.Version) >= 0)
                        {
                            log.Info($"The same or a newer version of package '{package.Name}' in already installed.");
                            continue;
                        }
                    }

                    gatheredPackages.Add(package);
                    log.Debug(timer, "Found package {0} locally.", packageReference.Name);
                }
                else
                {
                    PackageDef package = PackageActionHelpers.FindPackage(packageReference, force, installation, repositories);

                    if (noDowngrade)
                    {
                        var installedPackage = installedPackages.FirstOrDefault(p => p.Name == package.Name);
                        if (installedPackage != null && installedPackage.Version.CompareTo(package.Version) >= 0)
                        {
                            log.Info($"The same or a newer version of package '{package.Name}' in already installed.");
                            continue;
                        }
                    }

                    if (PackageCacheHelper.PackageIsFromCache(package))
                    {
                        log.Debug(timer, "Found package {0} version {1} in local cache", package.Name, package.Version);
                    }
                    else
                    {
                        log.Debug(timer, "Found package {0} version {1}", package.Name, package.Version);
                    }

                    gatheredPackages.Add(package);
                }
            }

            if (gatheredPackages.All(p => p.IsBundle()))
            {
                // If we are just installing bundles, we can assume that dependencies should also be installed
                includeDependencies = true;
            }

            log.Debug("Resolving dependencies.");
            var resolver = new DependencyResolver(installation, gatheredPackages, repositories);

            if (resolver.UnknownDependencies.Any())
            {
                foreach (var dep in resolver.UnknownDependencies)
                {
                    string message = string.Format("A package dependency named '{0}' with a version compatible with {1} could not be found in any repository.", dep.Name, dep.Version);

                    if (force)
                    {
                        log.Warning(message);
                        log.Warning("Continuing without downloading dependencies. Plugins will likely not work as expected.", dep.Name);
                    }
                    else
                    {
                        log.Error(message);
                    }
                }
                if (!force)
                {
                    log.Info("To download package dependencies despite the conflicts, use the --force option.");
                    return(null);
                }
            }
            else if (resolver.MissingDependencies.Any())
            {
                string dependencyArgsHint = "";
                if (!includeDependencies)
                {
                    dependencyArgsHint = $" (use --dependencies to also get these)";
                }
                if (resolver.MissingDependencies.Count > 1)
                {
                    log.Info("{0} required dependencies are currently not installed{1}.", resolver.MissingDependencies.Count, dependencyArgsHint);
                }
                else
                {
                    log.Info("A required dependency is currently not installed{0}.", dependencyArgsHint);
                }


                if (includeDependencies)
                {
                    //log.Debug($"Currently set to download dependencies quietly.");
                    foreach (var package in resolver.MissingDependencies)
                    {
                        log.Debug("Adding dependency {0} {1}", package.Name, package.Version);
                        gatheredPackages.Insert(0, package);
                    }
                }
                else if (askToIncludeDependencies)
                {
                    var pkgs = new List <DepRequest>();

                    foreach (var package in resolver.MissingDependencies)
                    {
                        // Handle each package at a time.
                        DepRequest req = null;
                        pkgs.Add(req = new DepRequest {
                            PackageName = package.Name, message = string.Format("Add dependency {0} {1} ?", package.Name, package.Version), Response = DepResponse.Add
                        });
                        UserInput.Request(req, true);
                    }

                    foreach (var pkg in resolver.MissingDependencies)
                    {
                        var res = pkgs.FirstOrDefault(r => r.PackageName == pkg.Name);

                        if ((res != null) && res.Response == DepResponse.Add)
                        {
                            gatheredPackages.Insert(0, pkg);
                        }
                    }
                }
            }

            return(gatheredPackages);
        }
Esempio n. 12
0
        public ComputerModel GetAllData()
        {
            computer.Open();
            computer.CpuEnabled       = true;
            computer.MainboardEnabled = true;
            computer.RAMEnabled       = true;
            computer.GPUEnabled       = true;
            hardware = computer.Hardware;
            CpuModel[] cpus = new CpuModel[] { };
            var        hwd  = hardware.OfType <GenericCPU>().ToArray();

            var hwCpus = hwd.OfType <GenericCPU>();

            var hwBios = hardware.OfType <Mainboard>()?.FirstOrDefault()?.BIOS;

            cpus = hwCpus.Select(cp =>
            {
                var l1CacheData         = cp.Caches.ContainsKey(CacheLevels.Level1) ? cp.Caches[CacheLevels.Level1].FirstOrDefault(ch => ch.CacheType == CacheType.Data) : null;
                var l1CacheInstructions = cp.Caches.ContainsKey(CacheLevels.Level1) ? cp.Caches[CacheLevels.Level1].FirstOrDefault(ch => ch.CacheType == CacheType.Instructions) : null;
                var l2Cache             = cp.Caches.ContainsKey(CacheLevels.Level2) ? cp.Caches[CacheLevels.Level2].FirstOrDefault() : null;
                var l3Cache             = cp.Caches.ContainsKey(CacheLevels.Level3) ? cp.Caches[CacheLevels.Level3].FirstOrDefault() : null;

                IntelCPU intelCpu = cp as IntelCPU;
                var specificCpu   = (intelCpu != null) ? intelCpu : ((cp is AMDCPU amdCPu) ? amdCPu : cp);

                var cpuModel = new CpuModel()
                {
                    Architecture              = ArchitectureHelper.GetArchitecture((uint)(specificCpu.Is64bit ? 9 : 0), 0),
                    Name                      = specificCpu.Name,
                    CodeName                  = specificCpu.CodeName,
                    Specification             = cp.BrandString,
                    NumberOfCores             = (uint)cp.Cores,
                    NumberOfLogicalProcessors = (uint)cp.Threads,
                    Technology                = cp.Technology,
                    CpuClocks                 = new CpuClocks()
                    {
                    },
                    CpuFamilyModelStepping = new CpuFamilyModelStepping()
                    {
                        FullFamily = (byte)cp.Family,
                        Family     = (byte)cp.FamilyId,
                        FullModel  = (byte)cp.Model,
                        Stepping   = (byte)cp.Stepping,
                    },
                    Instructions = GetInstructions(specificCpu, cp.InstructionsExtensions),
                    Caches       = new CpuCaches()
                    {
                        Level1Data = l1CacheData != null ? new CpuCacheItem()
                        {
                            Level         = 1,
                            Associativity = (byte)l1CacheData.Associativity,
                            Size          = l1CacheData.SizeKbytes * 1024,
                            LineSize      = l1CacheData.LineSize,
                            NumberOfCores = (uint)cp.Cores
                        } : new CpuCacheItem()
                        {
                        },
                        Level1Instructions = l1CacheInstructions != null ? new CpuCacheItem()
                        {
                            Level         = 1,
                            Associativity = (byte)l1CacheInstructions.Associativity,
                            Size          = l1CacheInstructions.SizeKbytes * 1024,
                            LineSize      = l1CacheInstructions.LineSize,
                            NumberOfCores = (uint)cp.Cores
                        } : new CpuCacheItem()
                        {
                        },
                        Level2 = l2Cache != null ? new CpuCacheItem()
                        {
                            Level         = 2,
                            Associativity = (byte)l2Cache.Associativity,
                            Size          = l2Cache.SizeKbytes * 1024,
                            LineSize      = l2Cache.LineSize,
                            NumberOfCores = (uint)cp.Cores
                        } : new CpuCacheItem()
                        {
                        },
                        Level3 = l3Cache != null ? new CpuCacheItem()
                        {
                            Level         = 3,
                            Associativity = (byte)l3Cache.Associativity,
                            LineSize      = l3Cache.LineSize,
                            Size          = l3Cache.SizeKbytes * 1024
                        } : new CpuCacheItem()
                        {
                        },
                    }
                };

                SetCpuClocks(cp, hwBios, cpuModel.CpuClocks);

                return(cpuModel);
            }).ToArray();


            Motherboard motherboard = null;

            if (hwBios != null && hwBios.Board != null)
            {
                motherboard = new Motherboard()
                {
                    Manufacturer = hwBios.Board.ManufacturerName,
                    Model        = hwBios.Board.ProductName,
                    Version      = hwBios.Board.Version
                };
            }
            else
            {
                motherboard = new Motherboard()
                {
                    Manufacturer = string.Empty,
                    Model        = string.Empty,
                    Version      = string.Empty
                };
            }

            Bios bios = null;

            if (hwBios != null && hwBios.BIOS != null)
            {
                bios = new Bios()
                {
                    Brand   = hwBios.BIOS.Vendor,
                    Date    = hwBios.BIOS.Date,
                    Version = hwBios.BIOS.Version
                };
            }
            else
            {
                bios = new Bios()
                {
                    Brand   = string.Empty,
                    Date    = string.Empty,
                    Version = string.Empty
                };
            }

            return(new ComputerModel()
            {
                Cpus = new AllCpus()
                {
                    Cpus = cpus,
                    RootCpu = cpus?[0],
                    TotalOfCores = cpus.Length > 1 ? (uint)cpus.Sum(c => c.NumberOfCores) : (cpus?[0]?.NumberOfCores ?? 0),
                    TotalOfLogicalProcessors = cpus.Length > 1 ? (uint)cpus.Sum(c => c.NumberOfLogicalProcessors) : (cpus?[0]?.NumberOfLogicalProcessors ?? 0),
                },
                Motherboard = motherboard,
                Bios = bios
            });
        }
Esempio n. 13
0
        private PackageDef GetPackageDefFromRepo(List <IPackageRepository> repositories, string name, VersionSpecifier version)
        {
            if (name.ToLower().EndsWith(".tappackage"))
            {
                name = Path.GetFileNameWithoutExtension(name);
            }

            var specifier = new PackageSpecifier(name, version, CpuArchitecture.Unspecified, OperatingSystem.Current.ToString());
            var packages  = PackageRepositoryHelpers.GetPackagesFromAllRepos(repositories, specifier, InstalledPackages.Values.ToArray());

            if (packages.Any() == false)
            {
                packages = PackageRepositoryHelpers.GetPackagesFromAllRepos(repositories, specifier);
                if (packages.Any())
                {
                    log.Warning($"Unable to find a version of '{name}' package compatible with currently installed packages. Some installed packages may be upgraded.");
                }
            }

            return(packages.OrderByDescending(pkg => pkg.Version).FirstOrDefault(pkg => ArchitectureHelper.PluginsCompatible(pkg.Architecture, ArchitectureHelper.HostArchitecture)));
        }