//===================================================================== /// <summary> /// This is overridden to allow cloning of a PDI object /// </summary> /// <returns>A clone of the object</returns> public override object Clone() { FreeBusyProperty o = new FreeBusyProperty(); o.Clone(this); return(o); }
/// <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) { FreeBusyProperty fbp = (FreeBusyProperty)p; freeBusyType = fbp.FreeBusyType; if (freeBusyType == FreeBusyType.Other) { otherType = fbp.OtherType; } else { otherType = null; } base.Clone(p); }
//===================================================================== /// <summary> /// This is overridden to allow cloning of a PDI object /// </summary> /// <returns>A clone of the object</returns> public override object Clone() { FreeBusyProperty o = new FreeBusyProperty(); o.Clone(this); return o; }
/// <summary> /// This is implemented to handle properties related to VFreeBusy 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 VFreeBusyParser(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 < ntvFreeBusy.Length - 1; idx++) if(ntvFreeBusy[idx].IsMatch(propertyName)) break; // An opening BEGIN:VFREEBUSY property must have been seen if(vFreeBusy == null) throw new PDIParserException(this.LineNumber, LR.GetString("ExParseNoBeginProp", "BEGIN:VFREEBUSY", propertyName)); // Handle or create the property switch(ntvFreeBusy[idx].EnumValue) { case PropertyType.Begin: // Handle unknown nested objects priorState.Push(currentState); currentState = VCalendarParserState.Custom; CustomObjectParser(propertyName, parameters, propertyValue); break; case PropertyType.End: // For this, the value must be VFREEBUSY if(String.Compare(propertyValue.Trim(), "VFREEBUSY", StringComparison.OrdinalIgnoreCase) != 0) throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue", ntvFreeBusy[idx].Name, propertyValue)); // The free/busy item is added to the collection when created so we don't have to rely on an // END tag to add it. vFreeBusy = null; currentState = priorState.Pop(); break; case PropertyType.Url: vFreeBusy.Url.DeserializeParameters(parameters); vFreeBusy.Url.EncodedValue = propertyValue; break; case PropertyType.UniqueId: vFreeBusy.UniqueId.EncodedValue = propertyValue; break; case PropertyType.StartDateTime: vFreeBusy.StartDateTime.DeserializeParameters(parameters); vFreeBusy.StartDateTime.EncodedValue = propertyValue; break; case PropertyType.EndDateTime: vFreeBusy.EndDateTime.DeserializeParameters(parameters); vFreeBusy.EndDateTime.EncodedValue = propertyValue; break; case PropertyType.Duration: vFreeBusy.Duration.DeserializeParameters(parameters); vFreeBusy.Duration.EncodedValue = propertyValue; break; case PropertyType.TimeStamp: vFreeBusy.TimeStamp.DeserializeParameters(parameters); vFreeBusy.TimeStamp.EncodedValue = propertyValue; break; case PropertyType.Comment: // If this is seen more than once, just add the new stuff to the existing property if(vFreeBusy.Comment.Value != null) { vFreeBusy.Comment.EncodedValue += "\r\n"; vFreeBusy.Comment.EncodedValue += propertyValue; } else { vFreeBusy.Comment.DeserializeParameters(parameters); vFreeBusy.Comment.EncodedValue = propertyValue; } break; case PropertyType.Contact: vFreeBusy.Contact.DeserializeParameters(parameters); vFreeBusy.Contact.EncodedValue = propertyValue; break; case PropertyType.Organizer: vFreeBusy.Organizer.DeserializeParameters(parameters); vFreeBusy.Organizer.EncodedValue = propertyValue; break; case PropertyType.Attendee: AttendeeProperty ap = new AttendeeProperty(); ap.DeserializeParameters(parameters); ap.EncodedValue = propertyValue; vFreeBusy.Attendees.Add(ap); break; case PropertyType.RequestStatus: RequestStatusProperty rs = new RequestStatusProperty(); rs.DeserializeParameters(parameters); rs.EncodedValue = propertyValue; vFreeBusy.RequestStatuses.Add(rs); break; case PropertyType.FreeBusy: // There may be more than one period 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); FreeBusyProperty fb = new FreeBusyProperty(); fb.DeserializeParameters(sc); fb.EncodedValue = s; vFreeBusy.FreeBusy.Add(fb); } break; default: // Anything else is a custom property CustomProperty cust = new CustomProperty(propertyName); cust.DeserializeParameters(parameters); cust.EncodedValue = propertyValue; vFreeBusy.CustomProperties.Add(cust); break; } }