Exemple #1
0
        public static List <object> GetRelatedUpdates(IUpdate update, UpdateRelationship type)
        {
            List <object>    ret     = new List <object>();
            UpdateCollection related = update.GetRelatedUpdates(type);

            foreach (IUpdate relupdate in related)
            {
                object o = Update.GetRelatedUpdateObject(update, relupdate);
                ret.Add(o);
            }

            return(ret);
        }
Exemple #2
0
        /// <summary>
        /// Checks a superseded update
        /// </summary>
        /// <param name="update">
        /// The update that is marked as superseded
        /// </param>
        /// <param name="approveLicenseAgreement">
        /// Whether to approve any license agreement
        /// </param>
        /// <param name="isTest">
        /// Whether we are in test mode
        /// </param>
        /// <param name="recentlyApproved">
        /// List of recently approved updates
        /// </param>
        /// <param name="shouldApproveUninstalledSupersededUpdate">
        /// The should Approve Uninstalled Superseded Update.
        /// </param>
        private static void CheckSupersededUpdate(
            IUpdate update,
            bool approveLicenseAgreement,
            bool isTest,
            List <Guid> recentlyApproved,
            bool shouldApproveUninstalledSupersededUpdate)
        {
            UpdateCollection superseding = update.GetRelatedUpdates(UpdateRelationship.UpdatesThatSupersedeThisUpdate);

            foreach (IUpdate newUpdate in superseding)
            {
                if (newUpdate.IsSuperseded)
                {
                    continue;
                }

                // check if we've already approved this update
                // this can happen if there has been more than 1 superseded update
                // and we've come across it during this run

                // we do it with a list as /test mode doesn't affect the .IsApproved state of an update
                if (!recentlyApproved.Contains(newUpdate.Id.UpdateId) && !newUpdate.IsApproved)
                {
                    if (newUpdate.RequiresLicenseAgreementAcceptance)
                    {
                        if (!approveLicenseAgreement)
                        {
                            Console.Out.WriteLine(
                                "Warning: Unable to approve '" + newUpdate.Title
                                + "' as it requires a license agreement and the current settings prevent this.");
                            continue;
                        }

                        newUpdate.AcceptLicenseAgreement();
                    }

                    ApproveSupersededUpdate(
                        newUpdate,
                        update,
                        isTest,
                        recentlyApproved,
                        shouldApproveUninstalledSupersededUpdate);
                }

                return;
            }
        }
Exemple #3
0
        /// <summary>
        /// Checks a superseded update
        /// </summary>
        /// <param name="update">
        /// The update that is marked as superseded
        /// </param>
        /// <param name="approveLicenseAgreement">
        /// Whether to approve any license agreement
        /// </param>
        /// <param name="isTest">
        /// Whether we are in test mode
        /// </param>
        /// <param name="recentlyApproved">
        /// List of recently approved updates
        /// </param>
        /// <param name="shouldApproveUninstalledSupersededUpdate">
        /// The should Approve Uninstalled Superseded Update.
        /// </param>
        private static void CheckSupersededUpdate(
            IUpdate update,
            bool approveLicenseAgreement,
            bool isTest,
            List<Guid> recentlyApproved,
            bool shouldApproveUninstalledSupersededUpdate)
        {
            UpdateCollection superseding = update.GetRelatedUpdates(UpdateRelationship.UpdatesThatSupersedeThisUpdate);

            foreach (IUpdate newUpdate in superseding)
            {
                if (newUpdate.IsSuperseded)
                {
                    continue;
                }

                // check if we've already approved this update
                // this can happen if there has been more than 1 superseded update
                // and we've come across it during this run

                // we do it with a list as /test mode doesn't affect the .IsApproved state of an update
                if (!recentlyApproved.Contains(newUpdate.Id.UpdateId) && !newUpdate.IsApproved)
                {
                    if (newUpdate.RequiresLicenseAgreementAcceptance)
                    {
                        if (!approveLicenseAgreement)
                        {
                            Console.Out.WriteLine(
                                "Warning: Unable to approve '" + newUpdate.Title
                                + "' as it requires a license agreement and the current settings prevent this.");
                            continue;
                        }

                        newUpdate.AcceptLicenseAgreement();
                    }

                    ApproveSupersededUpdate(
                        newUpdate,
                        update,
                        isTest,
                        recentlyApproved,
                        shouldApproveUninstalledSupersededUpdate);
                }

                return;
            }
        }