private void ReadRecurrencePattern(byte[] bytes) { AppointmentRecurrencePatternStructure structure = AppointmentRecurrencePatternStructure.GetRecurrencePatternStructure(bytes); m_startDTUtc = structure.GetStartDTUtc(this.OriginalTimeZone); m_duration = structure.Duration; RecurrenceType = structure.RecurrenceType; m_lastInstanceStartDate = structure.LastInstanceStartDate; Period = structure.PeriodInRecurrenceTypeUnits; if (structure.EndType == RecurrenceEndType.EndAfterNOccurrences) { EndAfterNumberOfOccurences = true; } switch (structure.RecurFrequency) { case RecurrenceFrequency.Daily: { break; } case RecurrenceFrequency.Weekly: { Day = (int)((WeeklyRecurrencePatternStructure)structure).DaysOfWeek; break; } case RecurrenceFrequency.Monthly: { if (structure.PatternType == PatternType.Month) { Day = (int)((MonthlyRecurrencePatternStructure)structure).DayOfMonth; } else // MonthNth { Day = (int)((MonthlyRecurrencePatternStructure)structure).DayOfWeek; DayOccurenceNumber = ((MonthlyRecurrencePatternStructure)structure).DayOccurenceNumber; } break; } case RecurrenceFrequency.Yearly: { if (structure.PatternType == PatternType.Month) { Day = (int)((YearlyRecurrencePatternStructure)structure).DayOfMonth; } else // MonthNth { Day = (int)((YearlyRecurrencePatternStructure)structure).DayOfWeek; DayOccurenceNumber = ((YearlyRecurrencePatternStructure)structure).DayOccurenceNumber; } } break; } DeletedInstanceDates = structure.DeletedInstanceDates; ExceptionList = structure.ExceptionList; }
public override void ReadPatternTypeSpecific(byte[] buffer, ref int offset) { // we start reading from offset 22 if (PatternType == PatternType.Month) // i.e. the 23th of every month { DayOfMonth = LittleEndianReader.ReadUInt32(buffer, ref offset); } else if (PatternType == PatternType.MonthNth) // i.e. the fourth monday of every month { DayOfWeek = (OutlookDayOfWeek)LittleEndianReader.ReadUInt32(buffer, ref offset); DayOccurenceNumber = (DayOccurenceNumber)LittleEndianReader.ReadUInt32(buffer, ref offset); } else { throw new InvalidRecurrencePatternException("Invalid Pattern Type"); } }