/// <inheritdoc />
 public void WriteIcs(IcsWriter writer)
 {
     var content = new ContentLine { Name = "related-to", Value = OtherUri };
     if (this.Relationship != null)
         content.Parameters[ParameterName.RelationshipType] = Relationship.Name;
     writer.Write(content);
 }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public void WriteIcs(IcsWriter writer)
 {
     var content = new ContentLine { Name = "contact", Value = Text };
     if (Uri != null)
         content.Parameters[ParameterName.AlternativeRepresentation] = Uri;
     writer.Write(content);
 }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.Event);
            ics.WriteContent("organizer", Organizer);
            ics.WriteContent(Attendees);
            ics.WriteContent("class", Classification.Name);
            ics.WriteContent("comment", Comment);
            ics.WriteContent("created", CreatedOn);
            ics.WriteContent("dtstamp", CreatedOnByAgent);
            ics.WriteContent("description", Description);
            ics.WriteContent("duration", Duration);
            ics.WriteContent("dtend", EndsOn);
            ics.WriteContent("geo", GlobalPosition);
            ics.WriteContent("uid", Id);
            if (IsTransparent)
                ics.WriteContent("transp", "TRANSPARENT");
            ics.WriteContent("location", Location);
            ics.WriteContent("last-modified", ModifiedOn);
            ics.WriteContent("exdate", ExcludedDates);
            ics.WriteContent(RecurrenceRule);
            if (Revision > 0)
                ics.WriteContent("sequence", Revision);
            ics.WriteContent("recurrence-id", RecurrenceId);
            ics.WriteContent("dtstart", StartsOn);
            ics.WriteContent("summary", Summary);
            if (Status != null)
                ics.WriteContent("status", Status.Name);
            ics.WriteContent("url", Uri);
            ics.WriteContent("categories", Categories == null ? null : Categories.Select(c => c.Name));
            ics.WriteContent(RequestStatuses);
            ics.WriteContent(Contacts);
            ics.WriteContent("resources", Resources);
            ics.WriteContent("rdate", RecurrenceDates);
            ics.WriteContent(Attachments);
            ics.WriteContent(Relationships);
            ics.WriteContent(Alarm);
            if (Priority != 0)
                ics.WriteContent("priority", Priority);
            ics.WriteEndComponent();
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public void WriteIcs(IcsWriter writer)
        {
            Guard.IsNotNull(writer, "writer");

            var content = new ContentLine { Name = PropertyName.Attachment };
            if (ContentType != null)
                content.Parameters[ParameterName.FormatType] = ContentType;

            if (Uri != null)
                content.Value = Uri;
            else if (Content != null)
            {
                content.Parameters[ParameterName.InlineEncoding] = "BASE64";
                content.Parameters["VALUE"] = "BINARY";
                content.Value = Convert.ToBase64String(Content);
            }

            writer.Write(content);
        }
Ejemplo n.º 5
0
 // TODO
 /// <inheritdoc />
 public void WriteIcs(IcsWriter writer)
 {
     writer.WriteContent("rrule", rule);
 }
Ejemplo n.º 6
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.Card);

            // Properties
            ics.WriteContent("version", Version);
            ics.WriteContent("prodid", ProductId);
            ics.WriteContent("kind", Kind);
            foreach (var source in Sources)
            {
                ics.Write(source.ToContentLine(new ContentLine { Name = "source" }));
            }

            foreach (var fn in FormattedNames)
            {
                ics.Write(fn.ToContentLine(new ContentLine { Name = "fn" }));
            }
            ics.WriteContent("gender", Gender);
            if (BirthDate != null)
                ics.Write(BirthDate.ToContentLine(new ContentLine { Name = "bday" }));

            foreach (var name in Names)
            {
                ics.Write(name.ToContentLine(new ContentLine { Name = "n" }));
            }
            foreach (var nickname in NickNames)
            {
                ics.Write(nickname.ToContentLine(new ContentLine { Name = "nickname" }));
            }
            foreach (var note in Notes)
            {
                ics.Write(note.ToContentLine(new ContentLine { Name = "note" }));
            }
            foreach (var email in Emails)
            {
                ics.Write(email.ToContentLine(new ContentLine { Name = "email" }));
            }
            foreach (var tel in Telephones)
            {
                ics.Write(tel.ToContentLine(new ContentLine { Name = "tel" }));
            }
            foreach (var lang in Languages)
            {
                ics.Write(lang.ToContentLine(new ContentLine { Name = "lang" }));
            }
            foreach (var tz in Timezones)
            {
                ics.Write(tz.ToContentLine(new ContentLine { Name = "tz" }));
            }
            foreach (var geo in GeographicPositions)
            {
                ics.Write(geo.ToContentLine(new ContentLine { Name = "geo" }));
            }
            foreach (var address in Addresses)
            {
                ics.Write(address.ToContentLine(new ContentLine { Name = "adr" }));
            }
            foreach (var url in Urls)
            {
                ics.Write(url.ToContentLine(new ContentLine { Name = "url" }));
            }
            foreach (var category in Categories)
            {
                ics.Write(category.ToContentLine(new ContentLine { Name = "categories" }));
            }
            foreach (var photo in Photos)
            {
                ics.Write(photo.ToContentLine(new ContentLine { Name = "photo" }));
            }
            ics.WriteEndComponent();
        }
Ejemplo n.º 7
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.FreeBusy);
            ics.WriteContent("organizer", Organizer);
            ics.WriteContent("comment", Comment);
            ics.WriteContent("dtstamp", CreatedOnByAgent);
            ics.WriteContent("dtend", EndsOn);
            ics.WriteContent("uid", Id);
            ics.WriteContent("dtstart", StartsOn);
            ics.WriteContent("url", Uri);
            ics.WriteContent(Attendees);
            ics.WriteContent(RequestStatuses);
            ics.WriteContent(Contact);
            ics.WriteContent(FreeBusyTimes);
            ics.WriteEndComponent();
        }
Ejemplo n.º 8
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.Calendar);

            // Properties
            ics.WriteContent("calscale", Scale);
            ics.WriteContent("method", Method);
            ics.WriteContent("prodid", ProductId);
            ics.WriteContent("version", Version);

            // Components
            foreach (var component in Components)
            {
                component.WriteIcs(ics);
            }

            ics.WriteEndComponent();
        }
Ejemplo n.º 9
0
        /// <inheritdoc />
        public void WriteIcs(IcsWriter writer)
        {
            Guard.IsNotNull(writer, "writer");

            const string form = "yyyyMMdd'T'HHmmss'Z'";
            var content = new ContentLine { Name = PropertyName.FreeBusy };
            content.Parameters["FBTYPE"] = Usage.Name.ToUpperInvariant();
            content.Values = TimeRanges
                .Select(t => t.StartsOn.UtcDateTime.ToString(form) + "/" + t.EndsOn.UtcDateTime.ToString(form))
                .ToArray();

            writer.Write(content);
        }
Ejemplo n.º 10
0
        /// <inheritdoc />
        public void WriteIcs(IcsWriter writer)
        {
            Guard.IsNotNull(writer, "writer");

            var content = new ContentLine { Name = "REQUEST-STATUS" };
            if (Description.Language != LanguageTag.Unspecified && Description.Language != null)
                content.Parameters[ParameterName.Language] = Description.Language.Name;
            var v = new StringBuilder();
            v.Append(Code ?? "");
            v.Append(';');
            v.Append(Description.Value);
            v.Append(';');
            v.Append(RelatedData ?? "");

            content.Values = new [] { v.ToString().TrimEnd(';') };
            writer.Write(content);
        }
Ejemplo n.º 11
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.TimeZone);
            ics.WriteContent("last-modified", ModifiedOn);
            ics.WriteContent("tzid", Id);
            ics.WriteContent("url", Uri);
            foreach (var adjustment in Adjustments)
            {
                adjustment.WriteIcs(ics);
            }
            ics.WriteEndComponent();
        }
Ejemplo n.º 12
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(ComponentName);
            ics.WriteContent("tzname", Name);
            ics.WriteContent("dtstart", StartsOn);
            ics.WriteContentAsUtcOffset("tzoffsetfrom", OffsetFrom);
            ics.WriteContentAsUtcOffset("tzoffsetto", OffsetTo);
            ics.WriteContent("comment", Comment);
            ics.WriteContent("rdate", RecurrenceDates);
            ics.WriteContent(RecurrenceRule);
            ics.WriteEndComponent();
        }
Ejemplo n.º 13
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.Journal);
            ics.WriteContent("organizer", Organizer);
            ics.WriteContent(Attendees);
            ics.WriteContent("class", Classification.Name);
            ics.WriteContent("comment", Comment);
            ics.WriteContent("created", CreatedOn);
            ics.WriteContent("dtstamp", CreatedOnByAgent);
            ics.WriteContent("description", Description);
            ics.WriteContent("uid", Id);
            ics.WriteContent("last-modified", ModifiedOn);
            ics.WriteContent("exdate", ExcludedDates);
            ics.WriteContent(RecurrenceRule);
            if (Revision > 0)
                ics.WriteContent("sequence", Revision);
            ics.WriteContent("recurrence-id", RecurrenceId);
            ics.WriteContent("dtstart", StartsOn);
            ics.WriteContent("summary", Summary);
            if (Status != null)
                ics.WriteContent("status", Status.Name);
            ics.WriteContent("url", Uri);
            if (Categories.Count > 0)
                ics.WriteContent("categories", Categories.Select(c => c.Name));
            ics.WriteContent(RequestStatuses);
            ics.WriteContent(Contacts);
            ics.WriteContent("rdate", RecurrenceDates);
            ics.WriteContent(Attachments);
            ics.WriteContent(Relationships);
            ics.WriteEndComponent();
        }
Ejemplo n.º 14
0
        /// <inheritdoc/>
        public void WriteIcs(IcsWriter ics)
        {
            Guard.IsNotNull(ics, "ics");

            ics.WriteBeginComponent(Component.Names.Alarm);
            ics.WriteContent(Attendees);
            ics.WriteContent("action", Action.Name);
            var trigger = new ContentLine { Name = "trigger" };
            if (TriggerOn.HasValue)
            {
                trigger.Parameters["value"] = "DATE-TIME";
                trigger.Value = IcsWriter.IsoFormat(TriggerOn.Value);
            }
            else if (TriggerDuration.HasValue)
            {
                if (TriggerEdge == TriggerEdge.End)
                    trigger.Parameters["related"] = "END";
                trigger.Value = XmlConvert.ToString(TriggerDuration.Value);
            }
            ics.Write(trigger);
            ics.WriteContent("description", Description);
            ics.WriteContent("summary", Summary);
            ics.WriteContent("duration", Duration);
            ics.WriteContent(Attachment);
            if (Repeat > 0)
                ics.WriteContent("repeat", Repeat);
            ics.WriteEndComponent();
        }