Beispiel #1
0
        private Task <PackageList> GetPackages(int pagenumber)
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    var result = from item in packages.Repo.GetPackages()
                                 where item.IsLatestVersion && (item.Tags == null || !item.Tags.Contains(HideReleaseFromEndUser))
                                 select item;

                    var info = new PackageList();
                    //info.TotalPackageCount = result.Count();
                    //info.packages = result.Skip(pagenumber * Paging.PageSize).Take(Paging.PageSize).ToArray();
                    info.packages = result.ToArray(); //Toggle comments here to reenable paging.

                    return(info);
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return(null);
                }
            });

            return(task);
        }
Beispiel #2
0
        private Task <PackageList> GetPackages(int pagenumber)
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    var result = from item in _packages.Repo.GetPackages() where item.Tags != null && item.Tags.Contains(DotSpatialPluginTag) select item;
                    result     = result.OrderBy(item => item.Id).ThenByDescending(item => item.Version);

                    string id = string.Empty;
                    List <IPackage> onlinePacks = new List <IPackage>();
                    foreach (var item in result)
                    {
                        if (id != item.Id && AppDependencyCheck(item))
                        {
                            onlinePacks.Add(item);
                            id = item.Id;
                        }
                    }

                    if (onlinePacks.Count == 0)
                    {
                        throw new InvalidOperationException();
                    }

                    var info = new PackageList
                    {
                        // Toggle comments here to reenable paging.
                        // info.TotalPackageCount = result.Count();
                        // info.packages = result.Skip(pagenumber * Paging.PageSize).Take(Paging.PageSize).ToArray();
                        Packages = onlinePacks.ToArray()
                    };

                    return(info);
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return(null);
                }
            });

            return(task);
        }
Beispiel #3
0
        //Return list of all packages from currently selected feed.
        private Task <PackageList> getAllPackagesFromFeed()
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    List <IPackage> result = new List <IPackage>();
                    var allPackages        = from item in packages.Repo.GetPackages() where
                                             (item.Tags == null || (!item.Tags.Contains(HideReleaseFromEndUser)))
                                             select item;

                    var sortedPackages = allPackages.OrderBy(item => item.Id)
                                         .ThenByDescending(item => item.Version);

                    String id = "";

                    foreach (var package in sortedPackages)
                    {
                        if (id != package.Id && MinVersionCheck(package))
                        {
                            result.Add(package);
                            id = package.Id;
                        }
                    }

                    var info = new PackageList();
                    info.TotalPackageCount = result.Count();
                    info.packages          = result.ToArray();
                    return(info);
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return(null);
                }
            });

            return(task);
        }
Beispiel #4
0
        private Task<PackageList> GetPackages(int pagenumber)
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    var result = from item in packages.Repo.GetPackages()
                                 where item.Id.Contains("Plugins") && (item.Tags == null || !item.Tags.Contains(HideReleaseFromEndUser))
                                 select item;
                    result = result.OrderBy(item => item.Id)
                                .ThenByDescending(item => item.Version);

                    String id = "";
                    List<IPackage> onlinePacks = new List<IPackage>();
                    foreach (var item in result)
                    {
                        if (id != item.Id && AppDependencyCheck(item))
                        {
                            onlinePacks.Add(item);
                            id = item.Id;
                        }
                    }
                    if(onlinePacks.Count() == 0)
                        throw new InvalidOperationException();

                    var info = new PackageList();
                    //info.TotalPackageCount = result.Count();
                    //info.packages = result.Skip(pagenumber * Paging.PageSize).Take(Paging.PageSize).ToArray();
                    info.packages = onlinePacks.ToArray(); //Toggle comments here to reenable paging.

                    return info;
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return null;
                }
            });
            return task;
        }
Beispiel #5
0
        //Return list of all packages from currently selected feed.
        private Task<PackageList> getAllPackagesFromFeed()
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    List<IPackage> result = new List<IPackage>();
                    var allPackages = from item in packages.Repo.GetPackages() where
                                 (item.Tags == null || (!item.Tags.Contains(HideReleaseFromEndUser)))
                                 select item;

                    var sortedPackages = allPackages.OrderBy(item => item.Id)
                                    .ThenByDescending(item => item.Version);

                    String id = "";

                    foreach(var package in sortedPackages)
                    {
                        if (id != package.Id && MinVersionCheck(package))
                        {
                            result.Add(package);
                            id = package.Id;
                        }
                    }
                    
                    var info = new PackageList();
                    info.TotalPackageCount = result.Count();
                    info.packages = result.ToArray();
                    return info;
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return null;
                }
            });
            return task;
        }
Beispiel #6
0
        private Task<PackageList> GetPackages(int pagenumber)
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    var result = from item in packages.Repo.GetPackages()
                                 where item.IsLatestVersion && (item.Tags == null || !item.Tags.Contains(HideReleaseFromEndUser))
                                 select item;

                    var info = new PackageList();
                    //info.TotalPackageCount = result.Count();
                    //info.packages = result.Skip(pagenumber * Paging.PageSize).Take(Paging.PageSize).ToArray();
                    info.packages = result.ToArray(); //Toggle comments here to reenable paging.

                    return info;
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return null;
                }
            });
            return task;
        }
Beispiel #7
0
        //Return list of all packages from currently selected feed.
        private Task<PackageList> getAllPackagesFromFeed()
        {
            var task = Task.Factory.StartNew(() =>
            {
                try
                {
                    var result = from item in packages.Repo.GetPackages()
                                 where item.IsLatestVersion && (item.Tags == null 
                                 || (!item.Tags.Contains(HideReleaseFromEndUser)))
                                 select item;

                    var info = new PackageList();
                    info.TotalPackageCount = result.Count();
                    info.packages = result.ToArray();
                    return info;
                }
                catch (InvalidOperationException)
                {
                    // This usually means the url was bad.
                    return null;
                }
            });
            return task;
        }