internal CalendarPeriod(string s, ComplianceTracker tracker) { int num = s.IndexOf('/'); if (num <= 0 || s.Length - 1 == num) { tracker.SetComplianceStatus(ComplianceStatus.InvalidValueFormat, CalendarStrings.InvalidTimeFormat); this.start = CalendarCommon.MinDateTime; this.end = CalendarCommon.MinDateTime; this.duration = TimeSpan.Zero; this.isExplicitPeriod = false; return; } DateTime dateTime = CalendarCommon.ParseDateTime(s.Substring(0, num), tracker); char c = s[num + 1]; if (c == '+' || c == '-' || c == 'P') { TimeSpan t = CalendarCommon.ParseDuration(s.Substring(num + 1), tracker); this.start = dateTime; this.end = dateTime + t; this.duration = t; this.isExplicitPeriod = false; return; } DateTime d = CalendarCommon.ParseDateTime(s.Substring(num + 1), tracker); this.start = dateTime; this.end = d; this.duration = dateTime - d; this.isExplicitPeriod = true; }
// Token: 0x0600070F RID: 1807 RVA: 0x00028134 File Offset: 0x00026334 private DateTime ReadValueAsDateTime(CalendarValueSeparators?expectedSeparators) { this.reader.AssertValidState(ContentLineNodeType.Parameter | ContentLineNodeType.Property); string s = this.ReadValueAsString(expectedSeparators).Trim(); if (CalendarValueType.Date == this.ValueType) { return(CalendarCommon.ParseDate(s, this.reader.ComplianceTracker)); } this.CheckType(CalendarValueType.DateTime); return(CalendarCommon.ParseDateTime(s, this.reader.ComplianceTracker)); }
// Token: 0x06000712 RID: 1810 RVA: 0x000281BC File Offset: 0x000263BC private DateTime ReadValueAsDateTime(CalendarValueType valueType, CalendarValueSeparators?expectedSeparators) { this.reader.AssertValidState(ContentLineNodeType.Parameter | ContentLineNodeType.Property); string s = this.ReadValueAsString(expectedSeparators).Trim(); if (CalendarValueType.DateTime == valueType || CalendarValueType.Text == valueType) { this.CheckType(CalendarValueType.DateTime); return(CalendarCommon.ParseDateTime(s, this.reader.ComplianceTracker)); } if (CalendarValueType.Date == valueType) { this.CheckType(CalendarValueType.Date); return(CalendarCommon.ParseDate(s, this.reader.ComplianceTracker)); } throw new ArgumentOutOfRangeException("valueType"); }
// Token: 0x06000881 RID: 2177 RVA: 0x0002ED10 File Offset: 0x0002CF10 internal Recurrence(string s, ComplianceTracker tracker) { this.tracker = tracker; Recurrence.ParserStates parserStates = Recurrence.ParserStates.Name; int length = s.Length; string s2 = string.Empty; List <string> list = new List <string>(); int i = 0; while (i < length) { switch (parserStates) { case Recurrence.ParserStates.Name: { StringBuilder stringBuilder = new StringBuilder(); while (i < length) { char c = s[i++]; if ((int)c >= ContentLineParser.Dictionary.Length || (byte)(ContentLineParser.Dictionary[(int)c] & ContentLineParser.Tokens.ValueChar) == 0) { this.SetComplianceStatus(CalendarStrings.InvalidCharacterInRecurrence); return; } if (c == '=') { break; } stringBuilder.Append(c); } s2 = stringBuilder.ToString(); parserStates = Recurrence.ParserStates.Value; break; } case Recurrence.ParserStates.Value: { bool flag = false; StringBuilder stringBuilder = new StringBuilder(); while (i < length) { char c = s[i++]; if ((int)c >= ContentLineParser.Dictionary.Length || (byte)(ContentLineParser.Dictionary[(int)c] & ContentLineParser.Tokens.ValueChar) == 0) { this.SetComplianceStatus(CalendarStrings.InvalidCharacterInRecurrence); return; } if (c == ';') { flag = true; parserStates = Recurrence.ParserStates.Name; break; } if (c == ',') { flag = false; break; } stringBuilder.Append(c); } list.Add(stringBuilder.ToString()); if (flag || i == length) { int num = list.Count; RecurrenceProperties recurProp = Recurrence.GetRecurProp(s2); if (recurProp <= RecurrenceProperties.ByDay) { if (recurProp <= RecurrenceProperties.BySecond) { switch (recurProp) { case RecurrenceProperties.Frequency: if (num > 1) { this.SetComplianceStatus(CalendarStrings.MultivalueNotPermittedOnFreq); return; } this.freq = Recurrence.GetFrequency(list[0]); if (this.freq == Frequency.Unknown) { this.SetComplianceStatus(CalendarStrings.UnknownFrequencyValue); return; } this.props |= RecurrenceProperties.Frequency; break; case RecurrenceProperties.UntilDate: if (num > 1) { this.SetComplianceStatus(CalendarStrings.MultivalueNotPermittedOnUntil); return; } if ((this.props & RecurrenceProperties.UntilDate) != RecurrenceProperties.None || (this.props & RecurrenceProperties.UntilDateTime) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.UntilOnlyPermittedOnce); return; } if ((this.props & RecurrenceProperties.Count) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.UntilNotPermittedWithCount); return; } if (list[0].Length > 8) { this.untilDateTime = CalendarCommon.ParseDateTime(list[0], tracker); this.props |= RecurrenceProperties.UntilDateTime; } else { this.untilDate = CalendarCommon.ParseDate(list[0], tracker); this.props |= RecurrenceProperties.UntilDate; } break; case RecurrenceProperties.Frequency | RecurrenceProperties.UntilDate: goto IL_A5C; case RecurrenceProperties.Count: if ((this.props & RecurrenceProperties.Count) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.CountOnlyPermittedOnce); return; } if ((this.props & RecurrenceProperties.UntilDate) != RecurrenceProperties.None || (this.props & RecurrenceProperties.UntilDateTime) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.CountNotPermittedWithUntil); return; } if (num > 1) { this.SetComplianceStatus(CalendarStrings.MultivalueNotPermittedOnCount); return; } if (!int.TryParse(list[0], out this.count)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.props |= RecurrenceProperties.Count; break; default: if (recurProp != RecurrenceProperties.Interval) { if (recurProp != RecurrenceProperties.BySecond) { goto IL_A5C; } if ((this.props & RecurrenceProperties.BySecond) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.BySecondOnlyPermittedOnce); return; } this.bySecond = new int[num]; for (int j = 0; j < num; j++) { if (!int.TryParse(list[j], out this.bySecond[j])) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } if (this.bySecond[j] < 0 || this.bySecond[j] > 59) { this.SetComplianceStatus(CalendarStrings.BySecondOutOfRange); return; } } this.props |= RecurrenceProperties.BySecond; } else { if ((this.props & RecurrenceProperties.Interval) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.IntervalOnlyPermittedOnce); return; } if (num > 1) { this.SetComplianceStatus(CalendarStrings.MultivalueNotPermittedOnInterval); return; } if (!int.TryParse(list[0], out this.interval)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } if (this.interval < 1) { this.SetComplianceStatus(CalendarStrings.IntervalMustBePositive); return; } this.props |= RecurrenceProperties.Interval; } break; } } else if (recurProp != RecurrenceProperties.ByMinute) { if (recurProp != RecurrenceProperties.ByHour) { if (recurProp != RecurrenceProperties.ByDay) { goto IL_A5C; } if ((this.props & RecurrenceProperties.ByDay) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByDayOnlyPermittedOnce); return; } this.byDay = new Recurrence.ByDay[num]; for (int k = 0; k < num; k++) { string text = list[k]; if (text.Length != 0) { int num2 = 0; while (num2 < text.Length && text[num2] == ' ') { num2++; } if (num2 != text.Length) { int num3 = num2 - 1; char c2; do { c2 = text[++num3]; if ((int)c2 >= ContentLineParser.Dictionary.Length) { goto Block_53; } }while (((byte)(ContentLineParser.Dictionary[(int)c2] & ContentLineParser.Tokens.Digit) > 0 || c2 == '+' || c2 == '-') && num3 + 1 < text.Length); IL_66C: if (num3 != num2) { int num4 = 0; string s3 = text.Substring(num2, num3 - num2); if (!int.TryParse(s3, out num4) || num4 == 0) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.byDay[k].OccurrenceNumber = num4; } while (text[num3] == ' ' && num3 + 1 < text.Length) { num3++; } this.byDay[k].Day = this.GetDayOfWeek(text.Substring(num3, text.Length - num3)); goto IL_700; Block_53: this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); goto IL_66C; } } IL_700 :; } this.props |= RecurrenceProperties.ByDay; } else { if ((this.props & RecurrenceProperties.ByHour) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByHourOnlyPermittedOnce); return; } this.byHour = new int[num]; for (int l = 0; l < num; l++) { if (!int.TryParse(list[l], out this.byHour[l])) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } if (this.byHour[l] < 0 || this.byHour[l] > 23) { this.SetComplianceStatus(CalendarStrings.ByHourOutOfRange); return; } } this.props |= RecurrenceProperties.ByHour; } } else { if ((this.props & RecurrenceProperties.ByMinute) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByMinuteOnlyPermittedOnce); return; } this.byMinute = new int[num]; for (int m = 0; m < num; m++) { if (!int.TryParse(list[m], out this.byMinute[m])) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } if (this.byMinute[m] < 0 || this.byMinute[m] > 59) { this.SetComplianceStatus(CalendarStrings.ByMinuteOutOfRange); return; } } this.props |= RecurrenceProperties.ByMinute; } } else if (recurProp <= RecurrenceProperties.ByWeek) { if (recurProp != RecurrenceProperties.ByMonthDay) { if (recurProp != RecurrenceProperties.ByYearDay) { if (recurProp != RecurrenceProperties.ByWeek) { goto IL_A5C; } if ((this.props & RecurrenceProperties.ByWeek) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByWeekNoOnlyPermittedOnce); return; } this.byWeekNumber = new int[num]; for (int n = 0; n < num; n++) { int num5; if (!int.TryParse(list[n], out num5)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.byWeekNumber[n] = num5; if (num5 == 0 || num5 > 53 || num5 < -53) { this.SetComplianceStatus(CalendarStrings.ByWeekNoOutOfRange); return; } } this.props |= RecurrenceProperties.ByWeek; } else { if ((this.props & RecurrenceProperties.ByYearDay) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByYearDayOnlyPermittedOnce); return; } this.byYearDay = new int[num]; for (int num6 = 0; num6 < num; num6++) { int num7; if (!int.TryParse(list[num6], out num7)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.byYearDay[num6] = num7; if (num7 == 0 || num7 > 366 || num7 < -366) { this.SetComplianceStatus(CalendarStrings.ByYearDayOutOfRange); return; } } this.props |= RecurrenceProperties.ByYearDay; } } else { if ((this.props & RecurrenceProperties.ByMonthDay) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByMonthDayOnlyPermittedOnce); return; } this.byMonthDay = new int[num]; for (int num8 = 0; num8 < num; num8++) { int num9; if (!int.TryParse(list[num8], out num9)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.byMonthDay[num8] = num9; if (num9 == 0 || num9 > 31 || num9 < -31) { this.SetComplianceStatus(CalendarStrings.ByMonthDayOutOfRange); return; } } this.props |= RecurrenceProperties.ByMonthDay; } } else if (recurProp != RecurrenceProperties.ByMonth) { if (recurProp != RecurrenceProperties.BySetPosition) { if (recurProp != RecurrenceProperties.WeekStart) { goto IL_A5C; } if ((this.props & RecurrenceProperties.WeekStart) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.WkStOnlyPermittedOnce); return; } if (num > 1) { this.SetComplianceStatus(CalendarStrings.MultivalueNotPermittedOnWkSt); return; } this.workWeekStart = this.GetDayOfWeek(list[0]); this.props |= RecurrenceProperties.WeekStart; } else { if ((this.props & RecurrenceProperties.BySetPosition) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.BySetPosOnlyPermittedOnce); return; } this.bySetPos = new int[num]; for (int num10 = 0; num10 < num; num10++) { int num11; if (!int.TryParse(list[num10], out num11)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.bySetPos[num10] = num11; if (num11 == 0 || num11 > 366 || num11 < -366) { this.SetComplianceStatus(CalendarStrings.BySetPosOutOfRange); return; } } this.props |= RecurrenceProperties.BySetPosition; } } else { if ((this.props & RecurrenceProperties.ByMonth) != RecurrenceProperties.None) { this.SetComplianceStatus(CalendarStrings.ByMonthOnlyPermittedOnce); return; } this.byMonth = new int[num]; for (int num12 = 0; num12 < num; num12++) { int num13; if (!int.TryParse(list[num12], out num13)) { this.SetComplianceStatus(CalendarStrings.InvalidValueFormat); } this.byMonth[num12] = num13; if (num13 < 0 || num13 > 12) { this.SetComplianceStatus(CalendarStrings.ByMonthOutOfRange); return; } } this.props |= RecurrenceProperties.ByMonth; } IL_A67: list = new List <string>(); break; IL_A5C: this.SetComplianceStatus(CalendarStrings.UnknownRecurrenceProperty); goto IL_A67; } break; } } } }