Пример #1
0
        private void uxUpdateAll_Click(object sender, EventArgs e)
        {
            ListViewItem[] Items = new ListViewItem[uxUpdatePackages.Items.Count];
            uxUpdatePackages.Items.CopyTo(Items, 0);

            for (int i = 0; i < Items.Length; i++)
            {
                var pack = Items[i].Tag as IPackage;
                try
                {
                    foreach (PackageDependency dependency in pack.Dependencies)
                    {
                        if (packages.GetLocalPackage(dependency.Id) == null)
                        {
                            packages.Update(packages.Repo.FindPackage(dependency.Id));
                        }
                    }

                    Updates.UpdatePackage(pack);
                }
                catch
                {
                    MessageBox.Show("Failed to update " + pack.GetFullName());
                }
            }

            uxUpdate.Enabled = true;
            DisplayPackagesAndUpdates();
            showUpdateComplete();
        }
Пример #2
0
        private IPackage GetPackageFromExtension(IExtension extension)
        {
            string id = extension.AssemblyQualifiedName.Substring(0, extension.AssemblyQualifiedName.IndexOf(',')); // Grab the part prior to the first comma

            id = id.Substring(0, id.LastIndexOf('.'));                                                              // Grab the part prior to the last period
            var pack = packages.GetLocalPackage(id);

            return(pack);
        }
Пример #3
0
        public IPackage GetPackageFromExtension(IExtension extension)
        {
            string id = extension.AssemblyQualifiedName.Substring(0, extension.AssemblyQualifiedName.IndexOf(',')); // Grab the part prior to the first comma

            if (id.Contains("."))
            {
                id = id.Substring(0, id.LastIndexOf('.')); // Grab the part prior to the last period, only if id contains period (Changed by JLeiss)
            }
            var pack = packages.GetLocalPackage(id);

            return(pack);
        }
Пример #4
0
        //autoUpdate any packages found in current feed.
        internal List <String> autoUpdate()
        {
            List <String> updatesOccurred = new List <String>();

            getAllAvailableUpdates();

            if (list != null && list.Count() > 0)
            {
                DialogResult dialogResult = MessageBox.Show("       " + list.Count() + " Updates available.\n\n" +
                                                            "Do you want to install them now?", "Updates available", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    foreach (IPackage p in list)
                    {
                        if ((p.Tags == null) || (!p.Tags.Contains(HideFromAutoUpdate)))
                        {
                            foreach (PackageDependency dependency in p.Dependencies)
                            {
                                if (packages.GetLocalPackage(dependency.Id) == null)
                                {
                                    packages.Update(packages.Repo.FindPackage(dependency.Id));
                                }
                            }

                            try
                            {
                                UpdatePackage(p);
                                updatesOccurred.Add(p.GetFullName());
                            }
                            catch
                            {
                                MessageBox.Show("Error updating " + p.GetFullName());
                            }
                        }
                    }
                }
            }
            return(updatesOccurred);
        }