Beispiel #1
0
 internal IEnumerable <PackageItem> GetPackageById(string name, string requiredVersion = null, string minimumVersion = null, string maximumVersion = null, bool allowUnlisted = false)
 {
     if (String.IsNullOrEmpty(name))
     {
         return(Enumerable.Empty <PackageItem>());
     }
     return(SelectedSources.AsParallel().WithMergeOptions(ParallelMergeOptions.NotBuffered).SelectMany(source => GetPackageById(source, name, requiredVersion, minimumVersion, maximumVersion, allowUnlisted)));
 }
Beispiel #2
0
        private void TuneControls()
        {
            var selected = SelectedSources.Select(c => c.Id).ToArray();

            _lb.ItemsSource = _data.Sources.OrderBy(c => c.Name);
            if (selected.Any())
            {
                _lb.SelectedItem = _data.Sources.FirstOrDefault(c => selected.Any(s => s == c.Id));
            }

            _btnEdit.IsEnabled   = SelectedSource != null;
            _btnRemove.IsEnabled = SelectedSources.Any();
        }
Beispiel #3
0
        internal IEnumerable <PackageItem> GetPackageByIdAndVersionSpec(string name, IVersionSpec versionSpec, bool allowUnlisted = false)
        {
            if (String.IsNullOrEmpty(name))
            {
                return(Enumerable.Empty <PackageItem>());
            }

            return(SelectedSources.AsParallel().WithMergeOptions(ParallelMergeOptions.NotBuffered).SelectMany(source => {
                var pkgs = source.Repository.FindPackages(name, versionSpec, AllowPrereleaseVersions, allowUnlisted);

                /*
                 * // necessary?
                 * pkgs = from p in pkgs where p.IsLatestVersion select p;
                 */

                var pkgs2 = pkgs.ToArray();

                return pkgs2.Select(pkg => new PackageItem {
                    Package = pkg,
                    PackageSource = source,
                    FastPath = MakeFastPath(source, pkg.Id, pkg.Version.ToString())
                });
            }).OrderByDescending(each => each.Package.Version));
        }
Beispiel #4
0
 internal IEnumerable <PackageItem> SearchForPackages(string name, string requiredVersion, string minimumVersion, string maximumVersion)
 {
     return(SelectedSources.AsParallel().WithMergeOptions(ParallelMergeOptions.NotBuffered).SelectMany(source => SearchSourceForPackages(source, name, requiredVersion, minimumVersion, maximumVersion)));
 }