Example #1
0
        private static string BuildMergedFreeBusyString(ExTimeZone timeZone, int mergedFreeBusyInterval, ExDateTime windowStart, ExDateTime windowEnd, int numberOfFreeBusySlots, CalendarEvent[] calendarEventArray, bool exceptionOccurred, byte[] globalObjectId, ExchangeVersionType requestedSchemaVersion)
        {
            char[] array = new char[numberOfFreeBusySlots];
            char   c;

            if (requestedSchemaVersion < ExchangeVersionType.Exchange2012)
            {
                c = (exceptionOccurred ? '4' : '0');
            }
            else
            {
                c = (exceptionOccurred ? '5' : '0');
            }
            for (int i = 0; i < numberOfFreeBusySlots; i++)
            {
                array[i] = c;
            }
            if (!exceptionOccurred && calendarEventArray != null)
            {
                int num = calendarEventArray.Length;
                int j   = 0;
                while (j < num)
                {
                    if (globalObjectId == null)
                    {
                        goto IL_72;
                    }
                    byte[] globalObjectId2 = calendarEventArray[j].GlobalObjectId;
                    if (globalObjectId2 == null || !ArrayComparer <byte> .Comparer.Equals(globalObjectId2, globalObjectId))
                    {
                        goto IL_72;
                    }
IL_B3:
                    j++;
                    continue;
IL_72:
                    ExDateTime startTime = new ExDateTime(timeZone, calendarEventArray[j].StartTime);
                    ExDateTime endTime  = new ExDateTime(timeZone, calendarEventArray[j].EndTime);
                    BusyType   busyType = calendarEventArray[j].BusyType;
                    MergedFreeBusy.AddAppointmentToFreeBusyString(windowStart, windowEnd, startTime, endTime, busyType, mergedFreeBusyInterval, array, requestedSchemaVersion);
                    goto IL_B3;
                }
            }
            return(new string(array));
        }
Example #2
0
        internal static string FromPublicFolderFreeBusyProperty(ExTimeZone timeZone, int mergedFreeBusyInterval, ExDateTime windowStart, ExDateTime windowEnd, PublicFolderFreeBusy freeBusyData, bool exceptionOccurred)
        {
            int num = MergedFreeBusy.NumberOfSlots(windowStart, windowEnd, mergedFreeBusyInterval);

            char[] array = new char[num];
            char   c     = exceptionOccurred ? '4' : '0';

            for (int i = 0; i < num; i++)
            {
                array[i] = c;
            }
            if (exceptionOccurred || freeBusyData == null || freeBusyData.Appointments == null || freeBusyData.Appointments.Count == 0)
            {
                return(new string(array));
            }
            foreach (PublicFolderFreeBusyAppointment publicFolderFreeBusyAppointment in freeBusyData.Appointments)
            {
                MergedFreeBusy.AddAppointmentToFreeBusyString(windowStart, windowEnd, publicFolderFreeBusyAppointment.StartTime, publicFolderFreeBusyAppointment.EndTime, (BusyType)publicFolderFreeBusyAppointment.BusyType, mergedFreeBusyInterval, array, ExchangeVersionType.Exchange2007);
            }
            return(new string(array));
        }