Example #1
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));
        }
Example #2
0
        public static string GenerateMergedFreeBusyString(ExTimeZone timeZone, int mergedFreeBusyInterval, ExDateTime windowStart, ExDateTime windowEnd, CalendarEvent[] calendarEventArray, bool exceptionOccurred, byte[] globalObjectId, ExchangeVersionType requestedSchemaVersion)
        {
            int numberOfFreeBusySlots = MergedFreeBusy.NumberOfSlots(windowStart, windowEnd, mergedFreeBusyInterval);

            return(MergedFreeBusy.BuildMergedFreeBusyString(timeZone, mergedFreeBusyInterval, windowStart, windowEnd, numberOfFreeBusySlots, calendarEventArray, exceptionOccurred, globalObjectId, requestedSchemaVersion));
        }