Пример #1
0
        public static void CheckHotfixEligibility(IXenConnection connection)
        {
            var master = Helpers.GetMaster(connection);

            if (master == null)
            {
                return;
            }

            var hotfixEligibility = HotfixEligibility(master, out var xenServerVersion);

            if (!HotfixEligibilityAlert.IsAlertNeeded(hotfixEligibility, xenServerVersion, !master.IsFreeLicenseOrExpired()))
            {
                Alert.RemoveAlert(a => a is HotfixEligibilityAlert && connection.Equals(a.Connection));
                return;
            }

            var alertIndex = Alert.FindAlertIndex(a => a is HotfixEligibilityAlert alert && connection.Equals(alert.Connection) && xenServerVersion == alert.Version);

            if (alertIndex == -1)
            {
                Alert.RemoveAlert(a => a is HotfixEligibilityAlert && connection.Equals(a.Connection)); // ensure that there is no other alert for this connection
                Alert.AddAlert(new HotfixEligibilityAlert(connection, xenServerVersion));
            }
            else
            {
                Alert.RefreshAlertAt(alertIndex);
            }
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            Search other = obj as Search;

            if (other == null)
            {
                return(false);
            }

            // Ifs are expanded to aid debuggin'

            if (!((name == null && other.name == null) || (name != null && name.Equals(other.Name))))
            {
                return(false);
            }

            if (!((query == null && other.query == null) || (query != null && query.Equals(other.Query))))
            {
                return(false);
            }

            if (!((grouping == null && other.grouping == null) || (grouping != null && grouping.Equals(other.grouping))))
            {
                return(false);
            }

            if (!((sorting == null && other.sorting == null) || (Helper.AreEqual(sorting, other.sorting))))
            {
                return(false);
            }

            if (!((connection == null && other.connection == null) || (connection != null && connection.Equals(other.connection))))
            {
                return(false);
            }

            return(true);
        }