public void Deserialize(System.IO.TextReader rdr, Serializer serializer) { string name, value; var parameters = new System.Collections.Specialized.NameValueCollection(); while (rdr.Property(out name, out value, parameters) && !string.IsNullOrEmpty(name)) { switch (name.ToUpper()) { case "TZID": ID = value; break; case "TZNAME": Name = value; break; case "DTSTART": Start = value.ToDateTime(); break; case "RRULE": var rule = serializer.GetService <Recurrence>(); rule.Deserialize(value, parameters); Recurrences.Add(rule); break; case "TZOFFSETFROM": OffsetFrom = value.ToOffset(); break; case "TZOFFSETTO": OffsetTo = value.ToOffset(); break; case "END": return; } } }
public void Deserialize(System.IO.TextReader rdr, Serializer serializer) { string name, value; var parameters = new System.Collections.Specialized.NameValueCollection(); while (rdr.Property(out name, out value, parameters) && !string.IsNullOrEmpty(name)) { switch (name.ToUpper()) { case "BEGIN": switch (value) { case "VALARM": var a = serializer.GetService <Alarm>(); a.Deserialize(rdr, serializer); Alarms.Add(a); break; } break; case "ATTENDEE": var contact = new Contact(); contact.Deserialize(value, parameters); Attendees.Add(contact); break; case "CATEGORIES": Categories = value.SplitEscaped().ToList(); break; case "CLASS": Class = value.ToEnum <Classes>(); break; case "CREATED": Created = value.ToDateTime(); break; case "DESCRIPTION": Description = value; break; case "DTEND": End = value.ToDateTime(); break; case "DTSTAMP": DTSTAMP = value.ToDateTime().GetValueOrDefault(); break; case "DTSTART": Start = value.ToDateTime(); break; case "LAST-MODIFIED": LastModified = value.ToDateTime(); break; case "LOCATION": Location = value; break; case "ORGANIZER": Organizer = serializer.GetService <Contact>(); Organizer.Deserialize(value, parameters); break; case "PRIORITY": Priority = value.ToInt(); break; case "SEQUENCE": Sequence = value.ToInt(); break; case "STATUS": Status = value.ToEnum <Statuses>(); break; case "SUMMARY": Summary = value; break; case "TRANSP": Transparency = value; break; case "UID": UID = value; break; case "URL": Url = value.ToUri(); break; case "ATTACH": var attach = value.ToUri(); if (attach != null) { Attachments.Add(attach); } break; case "RRULE": var rule = serializer.GetService <Recurrence>(); rule.Deserialize(null, parameters); Recurrences.Add(rule); break; case "END": return; default: Properties.Add(Tuple.Create(name, value, parameters)); break; } } IsAllDay = Start == End; }