private void ProcessZonePartEnd(CalendarEntry entry, CalendarTimeZone zone, TimeZonePart part, ComponentToken tkn) { if ((ComponentToken)GetToken(_components, entry.Value) != tkn) ReportError(entry, "Expected \"END:" + _components[(int)tkn].Text.ToUpper() + "\""); if (zone.Part == null) zone.Part = new List<TimeZonePart>(); zone.Part.Add(part); }
/// <summary> /// Skips the given component block (until it reaches /// the corresponding ctkn:END value) /// </summary> /// <param name="ctkn"></param> private void SkipComponent(ComponentToken ctkn) { int level = 1; CalendarEntry entry = GetNextEntry(); while (entry != null) { PropertyToken tkn = (PropertyToken) GetToken(_properties, entry.Id); switch (tkn) { case PropertyToken.Begin: level++; break; case PropertyToken.End: level--; if (level == 0) { if ((ComponentToken) GetToken(_components, entry.Value) != ctkn) { ReportError(entry, "Expected \"END:" + Enum.GetName(typeof(ComponentToken), ctkn).ToUpper() + "\""); } return; } break; } entry = GetNextEntry(); } ReportError(entry, "Expected \"END:" + Enum.GetName(typeof(ComponentToken), ctkn).ToUpper() + "\""); }
/// <summary> /// Processes VTimeZone parts (DayLight, Standard) /// </summary> /// <param name="zone"></param> /// <param name="tkn"></param> private void ProcessZonePart(CalendarTimeZone zone, ComponentToken tkn) { bool isDtStartValue = false; TimeZonePart part = new TimeZonePart(); CalendarEntry entry = GetNextEntry(); while (entry != null) { switch ((PropertyToken) GetToken(_properties, entry.Id)) { case PropertyToken.DtStart: part.StartDate = ProcessDate(entry, ref isDtStartValue); break; case PropertyToken.RDate: part.RecurDate = ProcessRDate(entry, part.RecurDate); break; case PropertyToken.RRule: part.RecurRule = ProcessRRule(entry); break; case PropertyToken.TzOffsetTo: part.OffsetTo = ProcessTzOffset(entry); break; case PropertyToken.End: ProcessZonePartEnd(entry, zone, part, tkn); return; } entry = GetNextEntry(); } ReportError(entry, "Expected \"END:" + _components[(int)tkn].Text.ToUpper() + "\""); }