Example #1
0
        internal override List <ComponentLine> BuildLines()
        {
            List <ComponentLine> lines = new List <ComponentLine>();

            lines.Add(new ComponentLine("SUMMARY:", Summary.Coalesce(Description.ToDescriptionString(), "Onbekend").ToSummary()));


            if (IsAllDayEvent)
            {
                lines.Add(new ComponentLine("DTSTART;VALUE=DATE:", StartEvent.ToCalendarDateUTC()));
                lines.Add(new ComponentLine("DTEND;VALUE=DATE:", EndEvent.ToCalendarDateUTC()));
            }
            else
            {
                var tz = new ComponentPart("TZID", TimeZone.ToOlsonName());

                lines.Add(new ComponentLine($"DTSTART;{tz}:", StartEvent, false));
                lines.Add(new ComponentLine($"DTEND;{tz}:", EndEvent, false));
            }

            DateTime now = DateTime.Now;

            //lines.Add(new ComponentLine("DTSTAMP:", now, true));
            lines.Add(new ComponentLine("UID:", $"{Code}@icalendarAPI"));
            //lines.Add(new ComponentLine("CLASS:", Class));
            //lines.Add(new ComponentLine("CATEGORIES:", Categories));
            lines.Add(new ComponentLine("STATUS:", Status));
            //lines.Add(new ComponentLine("TRANSP:", Transparancy));
            lines.Add(new ComponentLine("LOCATION:", Location.ToPascalCase()));
            //lines.Add(new ComponentLine("URL:", UrlNormalization.Instance.Normalize(Url)));
            //lines.Add(new ComponentLine("LAST-MODIFIED:", LastModified.Coalesce(now), true));
            //lines.Add(new ComponentLine("CREATED:", now, true));
            lines.Add(new ComponentLine("SEQUENCE:", Sequence));
            //lines.Add(new ComponentLine("DESCRIPTION:", Description.ToDescriptionString()));
            //lines.Add(new ComponentLine("PRIORITY:", Priority.ForceToRange<int>(0, 9)));
            //lines.Add(new ComponentLine("RESOURCES:", Resources));
            //lines.Add(new ComponentLine("REQUEST-STATUS:", RequestStatus));
            //lines.Add(new ComponentLine("X-ALT-DESC;FMTTYPE=text/html:", string.Empty)); //Description.ToHtml(true, 30)
            //lines.Add(new ComponentLine("X-MICROSOFT-CDO-BUSYSTATUS:", MicrosoftBusyStatus.Busy));
            //lines.Add(new ComponentLine("X-MICROSOFT-CDO-IMPORTANCE:", (int)MS_CDO_Importance.Normal));
            lines.AddRange(Attachments.Select(attachment => attachment.BuildLine()));

            //if (!string.IsNullOrEmpty(Description) || !string.IsNullOrEmpty(HtmlDescription))
            // output.AppendLine("X-ALT-DESC;" + FileMimeType.Html.ToCalendarString() + ";" + HtmlDescription.ToHtmlString(true).Coalesce(Description.ToHtml()));

            if (Alarm != null)
            {
                lines.AddRange(Alarm.BuildLines());
            }

            return(BuildComponent(lines));
        }