/// <summary> /// Loads the property value from json. /// </summary> /// <param name="value">The JSON value. Can be a JsonObject, string, number, bool, array, or null.</param> /// <param name="service">The service.</param> /// <param name="propertyBag">The property bag.</param> internal override void LoadPropertyValueFromJson(object value, ExchangeService service, PropertyBag propertyBag) { JsonObject jsonRecurrence = value as JsonObject; JsonObject jsonPattern = jsonRecurrence.ReadAsJsonObject(JsonNames.RecurrencePattern); Recurrence recurrence = GetRecurrenceFromString(jsonPattern.ReadTypeString()); recurrence.LoadFromJson(jsonPattern, service); JsonObject jsonRange = jsonRecurrence.ReadAsJsonObject(JsonNames.RecurrenceRange); RecurrenceRange range = GetRecurrenceRange(jsonRange.ReadTypeString()); range.LoadFromJson(jsonRange, service); range.SetupRecurrence(recurrence); propertyBag[this] = recurrence; }
/// <summary> /// Loads from XML. /// </summary> /// <param name="reader">The reader.</param> /// <param name="propertyBag">The property bag.</param> internal override void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) { reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Recurrence); Recurrence recurrence = null; reader.Read(XmlNodeType.Element); // This is the pattern element recurrence = GetRecurrenceFromString(reader.LocalName); recurrence.LoadFromXml(reader, reader.LocalName); reader.Read(XmlNodeType.Element); // This is the range element RecurrenceRange range = GetRecurrenceRange(reader.LocalName); range.LoadFromXml(reader, reader.LocalName); range.SetupRecurrence(recurrence); reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.Recurrence); propertyBag[this] = recurrence; }