Esempio n. 1
0
 public int GetHashCode(CalendarItemState obj)
 {
     if (obj == null || !obj.ContainsKey(this.stateKey))
     {
         return(0);
     }
     return(obj[this.stateKey].GetHashCode());
 }
        public int GetHashCode(CalendarItemState obj)
        {
            if (obj == null)
            {
                return(0);
            }
            int num = 0;

            foreach (ICalendarItemStateDefinition calendarItemStateDefinition in this.operands)
            {
                num = (num << 1 ^ calendarItemStateDefinition.GetHashCode(obj));
            }
            return(num);
        }
        public override ClientIntentQuery.QueryResult Execute(MailboxSession session, CalendarVersionStoreGateway cvsGateway)
        {
            bool isChainComplete                        = false;
            CalendarItemState previousState             = null;
            bool              foundVersionInTargetState = false;
            VersionedId       sourceVersionId           = null;
            ClientIntentFlags accumulatedFlags          = ClientIntentFlags.None;
            ClientIntentFlags intentToAccumulate        = ClientIntentFlags.None;

            base.RunQuery(session, cvsGateway, delegate(PropertyBag propertyBag)
            {
                CalendarItemState calendarItemState = new CalendarItemState();
                if (!foundVersionInTargetState)
                {
                    if (this.TargetState.Evaluate(calendarItemState, propertyBag, session))
                    {
                        foundVersionInTargetState = true;
                        intentToAccumulate        = this.GetClientIntentFromPropertyBag(propertyBag);
                        accumulatedFlags          = intentToAccumulate;
                    }
                }
                else if (this.InitialState.Evaluate(calendarItemState, propertyBag, session))
                {
                    isChainComplete   = true;
                    accumulatedFlags &= intentToAccumulate;
                    sourceVersionId   = this.GetIdFromPropertyBag(propertyBag);
                }
                else if (this.TargetState.Evaluate(calendarItemState, propertyBag, session))
                {
                    intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag);
                    accumulatedFlags   = intentToAccumulate;
                }
                else if (this.TargetState.Equals(calendarItemState, previousState))
                {
                    intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag);
                }
                else
                {
                    accumulatedFlags  &= intentToAccumulate;
                    intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag);
                }
                previousState = calendarItemState;
                return(!isChainComplete);
            });
            return(new ClientIntentQuery.QueryResult(isChainComplete ? new ClientIntentFlags?(accumulatedFlags) : null, sourceVersionId));
        }
Esempio n. 4
0
        public bool Evaluate(CalendarItemState state, PropertyBag propertyBag, MailboxSession session)
        {
            Util.ThrowOnNullArgument(state, "state");
            Util.ThrowOnNullArgument(propertyBag, "propertyBag");
            Util.ThrowOnNullArgument(session, "session");
            TValue tvalue;

            if (state.ContainsKey(this.stateKey))
            {
                tvalue = (TValue)((object)state[this.stateKey]);
            }
            else
            {
                tvalue = this.GetValueFromPropertyBag(propertyBag, session);
                state[this.stateKey] = tvalue;
            }
            return(this.Evaluate(tvalue));
        }
Esempio n. 5
0
        public override ClientIntentQuery.QueryResult Execute(MailboxSession session, CalendarVersionStoreGateway cvsGateway)
        {
            ClientIntentFlags targetVersionClientIntent = ClientIntentFlags.None;
            bool        foundVersionInTargetState       = false;
            VersionedId sourceVersionId = null;

            base.RunQuery(session, cvsGateway, delegate(PropertyBag propertyBag)
            {
                CalendarItemState state = new CalendarItemState();
                if (this.TargetState.Evaluate(state, propertyBag, session))
                {
                    targetVersionClientIntent = this.GetClientIntentFromPropertyBag(propertyBag);
                    sourceVersionId           = this.GetIdFromPropertyBag(propertyBag);
                    foundVersionInTargetState = true;
                }
                return(!foundVersionInTargetState);
            });
            return(new ClientIntentQuery.QueryResult(foundVersionInTargetState ? new ClientIntentFlags?(targetVersionClientIntent) : null, sourceVersionId));
        }
Esempio n. 6
0
        public bool Equals(CalendarItemState x, CalendarItemState y)
        {
            if (x == y)
            {
                return(true);
            }
            if (x == null || y == null)
            {
                return(false);
            }
            if (!x.ContainsKey(this.stateKey) || !y.ContainsKey(this.stateKey))
            {
                throw new ArgumentException("The states don't have the required data.");
            }
            object obj  = x[this.stateKey];
            object obj2 = y[this.stateKey];

            if (obj == null)
            {
                return(obj2 == null);
            }
            return(obj.Equals(obj2));
        }
 public bool Evaluate(CalendarItemState state, PropertyBag propertyBag, MailboxSession session)
 {
     return(this.operands.TrueForAll((ICalendarItemStateDefinition definition) => definition.Evaluate(state, propertyBag, session)));
 }
 public bool Equals(CalendarItemState x, CalendarItemState y)
 {
     return(this.operands.TrueForAll((ICalendarItemStateDefinition definition) => definition.Equals(x, y)));
 }