Esempio n. 1
0
 public void Writing()
 {
     var contact0 = new Contact(new ContentLine("CONTACT;ALTREP=\"http://example.com/pdi/jdoe.vcf\":Jim Dolittle\\, ABC Industries\\, +1-919-555-1234"));
     var ics = new StringWriter();
     contact0.WriteIcs(IcsWriter.Create(ics));
     var contact1 = new Contact(new ContentLine(ics.ToString()));
     Assert.AreEqual("Jim Dolittle, ABC Industries, +1-919-555-1234", contact1.Text);
     Assert.AreEqual("http://example.com/pdi/jdoe.vcf", contact1.Uri);
 }
Esempio n. 2
0
        /// <inheritdoc/>
        public void ReadIcs(IcsReader reader)
        {
            ContentLine content;
            while (null != (content = reader.ReadContentLine()))
            {
                switch (content.Name.ToLowerInvariant())
                {
                    case "end":
                        if (!content.Value.Equals(Component.Names.FreeBusy, StringComparison.InvariantCultureIgnoreCase))
                            throw new CalendarException(String.Format("Expected 'END:{0}' not '{1}'.", Component.Names.FreeBusy, content));
                        return;
                    case "dtstamp":
                        CreatedOnByAgent = content.ToDate();
                        break;
                    case "uid":
                        Id = content.Value;
                        break;
                    case "contact":
                        Contact = new Contact(content);
                        break;
                    case "dtstart":
                        StartsOn = content.ToDate();
                        break;
                    case "dtend":
                        EndsOn = content.ToDate();
                        break;
                    case "organizer":
                        Organizer = content.ToMailAddress();
                        break;
                    case "url":
                        Uri = content.Value;
                        break;
                    case "attendee":
                        Attendees.Add(new Attendee(content));
                        break;
                    case "comment":
                        Comment.Add(content.ToText());
                        break;
                    case "request-status":
                        RequestStatuses.Add(new RequestStatus(content));
                        break;
                    case "freebusy":
                        FreeBusyTimes.Add(new TimeSlot(content));
                        break;
                }
            }

            throw new CalendarException("Unexpected end of file.");
        }
Esempio n. 3
0
 public void Reading()
 {
     var contact = new Contact(new ContentLine("CONTACT;ALTREP=\"http://example.com/pdi/jdoe.vcf\":Jim Dolittle\\, ABC Industries\\, +1-919-555-1234"));
     Assert.AreEqual("Jim Dolittle, ABC Industries, +1-919-555-1234", contact.Text);
     Assert.AreEqual("http://example.com/pdi/jdoe.vcf", contact.Uri);
 }