Beispiel #1
0
        private static void AddAppointmentToFreeBusyString(ExDateTime windowStart, ExDateTime windowEnd, ExDateTime startTime, ExDateTime endTime, BusyType busyType, int mergedFreeBusyInterval, char[] freeBusyValues, ExchangeVersionType requestedSchemaVersion)
        {
            TimeSpan timeSpan  = startTime - windowStart;
            TimeSpan timeSpan2 = endTime - windowStart;
            int      num       = (int)timeSpan.TotalMinutes / mergedFreeBusyInterval;
            int      num2      = (int)(timeSpan2.TotalMinutes / (double)mergedFreeBusyInterval) - 1;

            if (timeSpan2.TotalMinutes % (double)mergedFreeBusyInterval > 0.0)
            {
                num2++;
            }
            if (num < 0)
            {
                num = 0;
            }
            if (num2 >= freeBusyValues.Length)
            {
                num2 = freeBusyValues.Length - 1;
            }
            char c = (char)(busyType + 48);

            for (int i = num; i <= num2; i++)
            {
                if (MergedFreeBusy.MergedFreeBusyWeight(freeBusyValues[i], requestedSchemaVersion) < MergedFreeBusy.MergedFreeBusyWeight(c, requestedSchemaVersion))
                {
                    freeBusyValues[i] = c;
                }
            }
        }
Beispiel #2
0
        public static FreeBusyQueryResult MergeGroupMemberResults(ExTimeZone timeZone, int mergedFreeBusyInterval, ExDateTime startTime, ExDateTime endTime, FreeBusyQuery[] freeBusyQueryMembers, ExchangeVersionType requestSchemaVersion)
        {
            int num = MergedFreeBusy.NumberOfSlots(startTime, endTime, mergedFreeBusyInterval);

            char[] array = new char[num];
            char   c     = (requestSchemaVersion < ExchangeVersionType.Exchange2012) ? '4' : '5';

            for (int i = 0; i < num; i++)
            {
                array[i] = c;
            }
            foreach (FreeBusyQuery freeBusyQuery in freeBusyQueryMembers)
            {
                if (freeBusyQuery.Result != null)
                {
                    string text = freeBusyQuery.Result.MergedFreeBusy;
                    if (text == null)
                    {
                        text = MergedFreeBusy.BuildMergedFreeBusyString(timeZone, mergedFreeBusyInterval, startTime, endTime, num, freeBusyQuery.Result.CalendarEventArray, freeBusyQuery.Result.ExceptionInfo != null, null, requestSchemaVersion);
                    }
                    for (int k = 0; k < array.Length; k++)
                    {
                        if (MergedFreeBusy.MergedFreeBusyWeight(array[k], requestSchemaVersion) < MergedFreeBusy.MergedFreeBusyWeight(text[k], requestSchemaVersion))
                        {
                            array[k] = text[k];
                        }
                    }
                }
            }
            return(new FreeBusyQueryResult(FreeBusyViewType.MergedOnly, null, new string(array), null));
        }