public void Write(VEvent vevent) { this.WriteLine("BEGIN:VEVENT"); this.WriteLine("LOCATION;ENCODING=QUOTED-PRINTABLE:{0}", (object)vevent.Location); if (vevent.AllDayEvent) { this.WriteLine("DTSTART;VALUE=DATE:{0:yyyyMMdd}", (object)vevent.UtcStartDate); this.WriteLine("DTEND;VALUE=DATE:{0:yyyyMMdd}", (object)vevent.UtcEndDate); } else { this.WriteLine("DTSTART:{0}Z", (object)vevent.UtcStartDate.ToString("s")); this.WriteLine("DTEND:{0}Z", (object)vevent.UtcEndDate.ToString("s")); } this.WriteLine("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:{0}", (object)vevent.Note.Replace("=", "=3D").Replace("\r\n", "=0D=0A")); this.WriteLine("SUMMARY:{0}", (object)vevent.Summary.Replace("\r\n", "")); this.WriteLine("PRIORITY:3"); this.WriteLine("UID:{0}", (object)Guid.NewGuid().ToString()); this.WriteLine("DTSTAMP:{0}Z", (object)DateTime.UtcNow.ToString("s")); this.WriteLine("ORGANIZER;CN={0}:MAILTO:{1}", (object)vevent.FullName, (object)vevent.Email); this.WriteLine("CLASS:PRIVATE"); this.WriteLine("CREATED:20070822T023640Z"); this.WriteLine("LAST-MODIFIED:20070822T034209Z"); this.WriteLine("SEQUENCE:4"); this.WriteLine("STATUS:CONFIRMED"); this.WriteLine("END:VEVENT"); }
private void DoLine(string line) { switch (line.Trim()) { case "BEGIN:VCALENDAR": this._vcal = new VCalendar(); this._vcal.Events = new List <VEvent>(); break; case "BEGIN:VEVENT": this._vevent = new VEvent(); break; case "END:VEVENT": this._vcal.Events.Add(this._vevent); break; default: this.ParseLine(line); break; } }
public VCalendarReader(Stream stream) : base(stream) { this._vcal = new VCalendar(); this._vevent = new VEvent(); }