Example #1
0
        //=====================================================================

        /// <summary>
        /// This is overridden to allow cloning of a PDI object
        /// </summary>
        /// <returns>A clone of the object</returns>
        public override object Clone()
        {
            CategoriesProperty o = new CategoriesProperty();

            o.Clone(this);
            return(o);
        }
Example #2
0
        /// <summary>
        /// This is overridden to allow copying of the additional properties
        /// </summary>
        /// <param name="p">The PDI object from which the settings are to be copied</param>
        protected override void Clone(PDIObject p)
        {
            VNote o = (VNote)p;

            this.ClearProperties();

            dateCreated = (DateCreatedProperty)o.DateCreated.Clone();
            lastModified = (LastModifiedProperty)o.LastModified.Clone();
            summary = (SummaryProperty)o.Summary.Clone();
            body = (BodyProperty)o.Body.Clone();
            classification = (ClassificationProperty)o.Classification.Clone();
            categories = (CategoriesProperty)o.Categories.Clone();
            uid = (UniqueIdProperty)o.UniqueId.Clone();

            this.CustomProperties.CloneRange(o.CustomProperties);
        }
Example #3
0
        /// <summary>
        /// The method can be called to clear all current property values from the vNote.  The version is left
        /// unchanged.
        /// </summary>
        public void ClearProperties()
        {
            uid = null;
            summary = null;
            body = null;
            classification = null;
            categories = null;
            dateCreated = null;
            lastModified = null;

            customProps = null;
        }
Example #4
0
        /// <summary>
        /// This is overridden to allow copying of the additional properties
        /// </summary>
        /// <param name="p">The PDI object from which the settings are to be copied</param>
        protected override void Clone(PDIObject p)
        {
            VEvent o = (VEvent)p;

            this.ClearProperties();

            classification = (ClassificationProperty)o.Classification.Clone();
            categories = (CategoriesProperty)o.Categories.Clone();
            resources = (ResourcesProperty)o.Resources.Clone();
            url = (UrlProperty)o.Url.Clone();
            uid = (UniqueIdProperty)o.UniqueId.Clone();
            geo = (GeographicPositionProperty)o.GeographicPosition.Clone();
            lastMod = (LastModifiedProperty)o.LastModified.Clone();
            dateCreated = (DateCreatedProperty)o.DateCreated.Clone();
            startDate = (StartDateProperty)o.StartDateTime.Clone();
            endDate = (EndDateProperty)o.EndDateTime.Clone();
            dateStamp = (TimeStampProperty)o.TimeStamp.Clone();
            summary = (SummaryProperty)o.Summary.Clone();
            desc = (DescriptionProperty)o.Description.Clone();
            location = (LocationProperty)o.Location.Clone();
            priority = (PriorityProperty)o.Priority.Clone();
            sequence = (SequenceProperty)o.Sequence.Clone();
            transp = (TimeTransparencyProperty)o.Transparency.Clone();
            rNum = (RecurrenceCountProperty)o.RecurrenceCount.Clone();
            comment = (CommentProperty)o.Comment.Clone();
            organizer = (OrganizerProperty)o.Organizer.Clone();
            recurId = (RecurrenceIdProperty)o.RecurrenceId.Clone();
            status = (StatusProperty)o.Status.Clone();
            duration = (DurationProperty)o.Duration.Clone();

            this.Contacts.CloneRange(o.Contacts);
            this.Attendees.CloneRange(o.Attendees);
            this.RelatedTo.CloneRange(o.RelatedTo);
            this.Attachments.CloneRange(o.Attachments);
            this.RequestStatuses.CloneRange(o.RequestStatuses);
            this.Alarms.CloneRange(o.Alarms);
            this.CustomProperties.CloneRange(o.CustomProperties);

            base.Clone(p);
        }
Example #5
0
        /// <summary>
        /// The method can be called to clear all current property values from the event.  The version is left
        /// unchanged.
        /// </summary>
        public override void ClearProperties()
        {
            classification = null;
            categories = null;
            resources = null;
            url = null;
            uid = null;
            geo = null;
            lastMod = null;
            dateCreated = null;
            startDate = null;
            endDate = null;
            dateStamp = null;
            summary = null;
            desc = null;
            location = null;
            priority = null;
            sequence = null;
            transp = null;
            rNum = null;
            comment = null;
            organizer = null;
            recurId = null;
            status = null;
            duration = null;

            contacts = null;
            attendees = null;
            relatedTo = null;
            attachments = null;
            reqStats = null;
            alarms = null;

            customProps = null;

            base.ClearProperties();
        }
Example #6
0
        /// <summary>
        /// This is overridden to allow copying of the additional properties
        /// </summary>
        /// <param name="p">The PDI object from which the settings are to be copied</param>
        protected override void Clone(PDIObject p)
        {
            VJournal o = (VJournal)p;

            this.ClearProperties();

            classification = (ClassificationProperty)o.Classification.Clone();
            categories = (CategoriesProperty)o.Categories.Clone();
            url = (UrlProperty)o.Url.Clone();
            uid = (UniqueIdProperty)o.UniqueId.Clone();
            lastMod = (LastModifiedProperty)o.LastModified.Clone();
            dateCreated = (DateCreatedProperty)o.DateCreated.Clone();
            startDate = (StartDateProperty)o.StartDateTime.Clone();
            timeStamp = (TimeStampProperty)o.TimeStamp.Clone();
            summary = (SummaryProperty)o.Summary.Clone();
            desc = (DescriptionProperty)o.Description.Clone();
            sequence = (SequenceProperty)o.Sequence.Clone();
            comment = (CommentProperty)o.Comment.Clone();
            organizer = (OrganizerProperty)o.Organizer.Clone();
            recurId = (RecurrenceIdProperty)o.RecurrenceId.Clone();
            status = (StatusProperty)o.Status.Clone();

            this.Contacts.CloneRange(o.Contacts);
            this.Attendees.CloneRange(o.Attendees);
            this.RelatedTo.CloneRange(o.RelatedTo);
            this.Attachments.CloneRange(o.Attachments);
            this.RequestStatuses.CloneRange(o.RequestStatuses);
            this.CustomProperties.CloneRange(o.CustomProperties);

            base.Clone(p);
        }
Example #7
0
        //=====================================================================

        /// <summary>
        /// This is overridden to allow cloning of a PDI object
        /// </summary>
        /// <returns>A clone of the object</returns>
        public override object Clone()
        {
            CategoriesProperty o = new CategoriesProperty();
            o.Clone(this);
            return o;
        }
Example #8
0
        /// <summary>
        /// The method can be called to clear all current property values from the vCard.  The version is left
        /// unchanged.
        /// </summary>
        public void ClearProperties()
        {
            groupName = null;

            fn = null;
            name = null;
            title = null;
            role = null;
            mailer = null;
            url = null;
            org = null;
            uid = null;
            bday = null;
            rev = null;
            tz = null;
            geo = null;
            key = null;
            photo = null;
            logo = null;
            sound = null;

            notes = null;
            addrs = null;
            labels = null;
            phones = null;
            email = null;
            agents = null;
            customProps = null;

            addProfile = false;
            mimeName = null;
            mimeSource = null;
            prodId = null;
            nickname = null;
            sortString = null;
            classification = null;
            categories = null;
        }
Example #9
0
        /// <summary>
        /// This is overridden to allow copying of the additional properties
        /// </summary>
        /// <param name="p">The PDI object from which the settings are to be copied</param>
        protected override void Clone(PDIObject p)
        {
            VCard o = (VCard)p;

            this.ClearProperties();

            groupName = o.Group;

            fn = (FormattedNameProperty)o.FormattedName.Clone();
            name = (NameProperty)o.Name.Clone();
            title = (TitleProperty)o.Title.Clone();
            role = (RoleProperty)o.Role.Clone();
            mailer = (MailerProperty)o.Mailer.Clone();
            url = (UrlProperty)o.Url.Clone();
            org = (OrganizationProperty)o.Organization.Clone();
            uid = (UniqueIdProperty)o.UniqueId.Clone();
            bday = (BirthDateProperty)o.BirthDate.Clone();
            rev = (LastRevisionProperty)o.LastRevision.Clone();
            tz = (TimeZoneProperty)o.TimeZone.Clone();
            geo = (GeographicPositionProperty)o.GeographicPosition.Clone();
            key = (PublicKeyProperty)o.PublicKey.Clone();
            photo = (PhotoProperty)o.Photo.Clone();
            logo = (LogoProperty)o.Logo.Clone();
            sound = (SoundProperty)o.Sound.Clone();

            this.Notes.CloneRange(o.Notes);
            this.Addresses.CloneRange(o.Addresses);
            this.Labels.CloneRange(o.Labels);
            this.Telephones.CloneRange(o.Telephones);
            this.EMailAddresses.CloneRange(o.EMailAddresses);
            this.Agents.CloneRange(o.Agents);
            this.CustomProperties.CloneRange(o.CustomProperties);

            addProfile = o.AddProfile;
            mimeName = (MimeNameProperty)o.MimeName.Clone();
            mimeSource = (MimeSourceProperty)o.MimeSource.Clone();
            prodId = (ProductIdProperty)o.ProductId.Clone();
            nickname = (NicknameProperty)o.Nickname.Clone();
            sortString = (SortStringProperty)o.SortString.Clone();
            classification = (ClassificationProperty)o.Classification.Clone();
            categories = (CategoriesProperty)o.Categories.Clone();
        }
Example #10
0
        /// <summary>
        /// This is implemented to handle properties related to VEvent items
        /// </summary>
        /// <param name="propertyName">The name of the property</param>
        /// <param name="parameters">A string collection containing the parameters and their values.  If empty,
        /// there are no parameters.</param>
        /// <param name="propertyValue">The value of the property.</param>
        protected virtual void VEventParser(string propertyName, StringCollection parameters, string propertyValue)
        {
            StringCollection sc;
            string[] parts, parms;
            int idx;

            // The last entry is always CustomProperty so scan for length minus one
            for(idx = 0; idx < ntvEvent.Length - 1; idx++)
                if(ntvEvent[idx].IsMatch(propertyName))
                    break;

            // An opening BEGIN:VEVENT property must have been seen
            if(vEvent == null)
                throw new PDIParserException(this.LineNumber, LR.GetString("ExParseNoBeginProp", "BEGIN:VEVENT",
                    propertyName));

            // Handle or create the property
            switch(ntvEvent[idx].EnumValue)
            {
                case PropertyType.Begin:    // Handle nested objects
                    priorState.Push(currentState);

                    // Is it an alarm?
                    if(String.Compare(propertyValue.Trim(), "VALARM", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        vAlarm = new VAlarm();
                        vEvent.Alarms.Add(vAlarm);
                        currentState = VCalendarParserState.VAlarm;
                    }
                    else
                    {
                        // Unknown/custom object
                        currentState = VCalendarParserState.Custom;
                        CustomObjectParser(propertyName, parameters, propertyValue);
                    }
                    break;

                case PropertyType.End:
                    // For this, the value must be VEVENT
                    if(String.Compare(propertyValue.Trim(), "VEVENT", StringComparison.OrdinalIgnoreCase) != 0)
                        throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue",
                            ntvEvent[idx].Name, propertyValue));

                    // The event is added to the collection when created so we don't have to rely on an END tag
                    // to add it.
                    vEvent = null;
                    currentState = priorState.Pop();
                    break;

                case PropertyType.Class:
                    vEvent.Classification.EncodedValue = propertyValue;
                    break;

                case PropertyType.Categories:
                    // If this is seen more than once, just add the new stuff to the existing property
                    CategoriesProperty cp = new CategoriesProperty();
                    cp.DeserializeParameters(parameters);
                    cp.EncodedValue = propertyValue;

                    foreach(string s in cp.Categories)
                        vEvent.Categories.Categories.Add(s);
                    break;

                case PropertyType.Resources:
                    // If this is seen more than once, just add the new stuff to the existing property
                    ResourcesProperty rp = new ResourcesProperty();
                    rp.DeserializeParameters(parameters);
                    rp.EncodedValue = propertyValue;

                    foreach(string s in rp.Resources)
                        vEvent.Resources.Resources.Add(s);
                    break;

                case PropertyType.Url:
                    vEvent.Url.DeserializeParameters(parameters);
                    vEvent.Url.EncodedValue = propertyValue;
                    break;

                case PropertyType.UniqueId:
                    vEvent.UniqueId.EncodedValue = propertyValue;
                    break;

                case PropertyType.LastModified:
                    vEvent.LastModified.DeserializeParameters(parameters);
                    vEvent.LastModified.EncodedValue = propertyValue;
                    break;

                case PropertyType.GeographicPosition:
                    vEvent.GeographicPosition.EncodedValue = propertyValue;
                    break;

                case PropertyType.DateCreated:
                    vEvent.DateCreated.DeserializeParameters(parameters);
                    vEvent.DateCreated.EncodedValue = propertyValue;
                    break;

                case PropertyType.StartDateTime:
                    vEvent.StartDateTime.DeserializeParameters(parameters);
                    vEvent.StartDateTime.EncodedValue = propertyValue;
                    break;

                case PropertyType.EndDateTime:
                    vEvent.EndDateTime.DeserializeParameters(parameters);
                    vEvent.EndDateTime.EncodedValue = propertyValue;
                    break;

                case PropertyType.TimeStamp:
                    vEvent.TimeStamp.DeserializeParameters(parameters);
                    vEvent.TimeStamp.EncodedValue = propertyValue;
                    break;

                case PropertyType.Summary:
                    vEvent.Summary.DeserializeParameters(parameters);
                    vEvent.Summary.EncodedValue = propertyValue;
                    break;

                case PropertyType.Description:
                    vEvent.Description.DeserializeParameters(parameters);
                    vEvent.Description.EncodedValue = propertyValue;
                    break;

                case PropertyType.Location:
                    vEvent.Location.DeserializeParameters(parameters);
                    vEvent.Location.EncodedValue = propertyValue;
                    break;

                case PropertyType.Priority:
                    vEvent.Priority.DeserializeParameters(parameters);
                    vEvent.Priority.EncodedValue = propertyValue;
                    break;

                case PropertyType.Sequence:
                    vEvent.Sequence.DeserializeParameters(parameters);
                    vEvent.Sequence.EncodedValue = propertyValue;
                    break;

                case PropertyType.Transparency:
                    vEvent.Transparency.DeserializeParameters(parameters);
                    vEvent.Transparency.EncodedValue = propertyValue;
                    break;

                case PropertyType.RecurrenceCount:
                    vEvent.RecurrenceCount.DeserializeParameters(parameters);
                    vEvent.RecurrenceCount.EncodedValue = propertyValue;
                    break;

                case PropertyType.Comment:
                    // If this is seen more than once, just add the new stuff to the existing property
                    if(vEvent.Comment.Value != null)
                    {
                        vEvent.Comment.EncodedValue += "\r\n";
                        vEvent.Comment.EncodedValue += propertyValue;
                    }
                    else
                    {
                        vEvent.Comment.DeserializeParameters(parameters);
                        vEvent.Comment.EncodedValue = propertyValue;
                    }
                    break;

                case PropertyType.Contact:
                    ContactProperty c = new ContactProperty();
                    c.DeserializeParameters(parameters);
                    c.EncodedValue = propertyValue;
                    vEvent.Contacts.Add(c);
                    break;

                case PropertyType.Organizer:
                    vEvent.Organizer.DeserializeParameters(parameters);
                    vEvent.Organizer.EncodedValue = propertyValue;
                    break;

                case PropertyType.Attendee:
                    AttendeeProperty ap = new AttendeeProperty();
                    ap.DeserializeParameters(parameters);
                    ap.EncodedValue = propertyValue;
                    vEvent.Attendees.Add(ap);
                    break;

                case PropertyType.RelatedTo:
                    RelatedToProperty rt = new RelatedToProperty();
                    rt.DeserializeParameters(parameters);
                    rt.EncodedValue = propertyValue;
                    vEvent.RelatedTo.Add(rt);
                    break;

                case PropertyType.Attachment:
                    AttachProperty att = new AttachProperty();
                    att.DeserializeParameters(parameters);
                    att.EncodedValue = propertyValue;
                    vEvent.Attachments.Add(att);
                    break;

                case PropertyType.RecurrenceId:
                    vEvent.RecurrenceId.DeserializeParameters(parameters);
                    vEvent.RecurrenceId.EncodedValue = propertyValue;
                    break;

                case PropertyType.Status:
                    vEvent.Status.DeserializeParameters(parameters);
                    vEvent.Status.EncodedValue = propertyValue;
                    break;

                case PropertyType.RequestStatus:
                    RequestStatusProperty rs = new RequestStatusProperty();
                    rs.DeserializeParameters(parameters);
                    rs.EncodedValue = propertyValue;
                    vEvent.RequestStatuses.Add(rs);
                    break;

                case PropertyType.Duration:
                    vEvent.Duration.DeserializeParameters(parameters);
                    vEvent.Duration.EncodedValue = propertyValue;
                    break;

                case PropertyType.AudioAlarm:
                case PropertyType.DisplayAlarm:
                case PropertyType.EMailAlarm:
                case PropertyType.ProcedureAlarm:
                    // These are converted to a VAlarm object
                    vAlarm = new VAlarm();
                    ParseVCalendarAlarm(ntvEvent[idx].EnumValue, parameters, propertyValue);
                    vEvent.Alarms.Add(vAlarm);
                    vAlarm = null;
                    break;

                case PropertyType.RecurrenceRule:
                    RRuleProperty rr = new RRuleProperty();
                    rr.DeserializeParameters(parameters);
                    rr.EncodedValue = propertyValue;
                    vEvent.RecurrenceRules.Add(rr);
                    break;

                case PropertyType.RecurDate:
                    // There may be more than one date in the value.  If so, split them into separate ones.  This
                    // makes it easier to manage.  They'll get written back out as individual properties but
                    // that's okay.
                    parts = propertyValue.Split(',', ';');

                    // It's important that we retain the same parameters for each one
                    parms = new string[parameters.Count];
                    parameters.CopyTo(parms, 0);

                    foreach(string s in parts)
                    {
                        sc = new StringCollection();
                        sc.AddRange(parms);

                        RDateProperty rd = new RDateProperty();
                        rd.DeserializeParameters(sc);
                        rd.EncodedValue = s;

                        vEvent.RecurDates.Add(rd);
                    }
                    break;

                case PropertyType.ExceptionRule:
                    ExRuleProperty er = new ExRuleProperty();
                    er.DeserializeParameters(parameters);
                    er.EncodedValue = propertyValue;
                    vEvent.ExceptionRules.Add(er);
                    break;

                case PropertyType.ExceptionDate:
                    // There may be more than one date in the value.  If so, split them into separate ones.  This
                    // makes it easier to manage.  They'll get written back out as individual properties but
                    // that's okay.
                    parts = propertyValue.Split(',', ';');

                    // It's important that we retain the same parameters for each one
                    parms = new string[parameters.Count];
                    parameters.CopyTo(parms, 0);

                    foreach(string s in parts)
                    {
                        sc = new StringCollection();
                        sc.AddRange(parms);

                        ExDateProperty ed = new ExDateProperty();
                        ed.DeserializeParameters(sc);
                        ed.EncodedValue = s;

                        vEvent.ExceptionDates.Add(ed);
                    }
                    break;

                case PropertyType.ExcludeStartDateTime:
                    // This is a custom property not defined by the spec
                    vEvent.ExcludeStartDateTime = (propertyValue[0] == '1');
                    break;

                default:    // Anything else is a custom property
                    CustomProperty cust = new CustomProperty(propertyName);
                    cust.DeserializeParameters(parameters);
                    cust.EncodedValue = propertyValue;
                    vEvent.CustomProperties.Add(cust);
                    break;
            }
        }