Пример #1
0
 public bool Equals(CalendarEvent calendarEvent)
 {
     return Equals(calendarEvent);
 }
Пример #2
0
        /// <summary>
        /// Parse VEVENT data and construct an CalendarEvent from it.
        /// </summary>
        private CalendarEvent ParseEvent(string eventData)
        {
            string summary = Regex.Match(eventData, "(?<=SUMMARY:)[A-Öa-ö ]*").Value;
            string description = Regex.Match(eventData, "(?<=DESCRIPTION:)[0-9A-Öa-ö ]*").Value;
            string start = Regex.Match(eventData, "(?<=DTSTART:)[0-9TZ]*").Value;
            string end = Regex.Match(eventData, "(?<=DTEND:)[0-9TZ]*").Value;
            CalendarEvent calendarEvent = new CalendarEvent();
            calendarEvent.Description = description;
            calendarEvent.Summary = summary;

            DateTime startTime;

            if (DateTime.TryParseExact(start, "yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture, DateTimeStyles.None, out startTime))
            {
                calendarEvent.Start = startTime;
            }

            DateTime endTime;

            if (DateTime.TryParseExact(end, "yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture, DateTimeStyles.None, out endTime))
            {
                calendarEvent.End = endTime;
            }

            return calendarEvent;
        }