/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { if (base.TryReadElementFromXml(reader)) { return(true); } else { switch (reader.LocalName) { case XmlElementNames.TimeOffset: this.timeOffset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue()); return(true); case XmlElementNames.Month: this.month = reader.ReadElementValue <int>(); EwsUtilities.Assert( this.month > 0 && this.month <= 12, "AbsoluteMonthTransition.TryReadElementFromXml", "month is not in the valid 1 - 12 range."); return(true); default: return(false); } } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service"></param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { foreach (string key in jsonProperty.Keys) { switch (key) { case XmlElementNames.BaseOffset: this.baseOffset = EwsUtilities.XSDurationToTimeSpan(jsonProperty.ReadAsString(key)); break; case XmlElementNames.Standard: this.standard = new TimeChange(); this.standard.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlElementNames.Daylight: this.daylight = new TimeChange(); this.daylight.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service); break; case XmlAttributeNames.TimeZoneName: this.name = jsonProperty.ReadAsString(key); break; default: break; } } }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.Offset: this.offset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue()); return(true); case XmlElementNames.RelativeYearlyRecurrence: this.Recurrence = new TimeChangeRecurrence(); this.Recurrence.LoadFromXml(reader, reader.LocalName); return(true); case XmlElementNames.AbsoluteDate: DateTime dateTime = DateTime.Parse(reader.ReadElementValue()); // TODO: BUG this.absoluteDate = new DateTime(dateTime.ToUniversalTime().Ticks, DateTimeKind.Unspecified); return(true); case XmlElementNames.Time: this.time = new Time(DateTime.Parse(reader.ReadElementValue())); return(true); default: return(false); } }
/// <summary> /// Loads from json. /// </summary> /// <param name="jsonProperty">The json property.</param> /// <param name="service">The service.</param> internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service) { base.LoadFromJson(jsonProperty, service); foreach (string key in jsonProperty.Keys) { switch (key) { case XmlAttributeNames.Id: this.id = jsonProperty.ReadAsString(key); break; case XmlAttributeNames.Name: this.name = jsonProperty.ReadAsString(key); break; case XmlAttributeNames.Bias: this.bias = EwsUtilities.XSDurationToTimeSpan(jsonProperty.ReadAsString(key)); break; } } }
/// <summary> /// Tries to read element from XML. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True if element was read.</returns> internal override bool TryReadElementFromXml(EwsServiceXmlReader reader) { switch (reader.LocalName) { case XmlElementNames.BaseOffset: this.baseOffset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue()); return(true); case XmlElementNames.Standard: this.standard = new TimeChange(); this.standard.LoadFromXml(reader, reader.LocalName); return(true); case XmlElementNames.Daylight: this.daylight = new TimeChange(); this.daylight.LoadFromXml(reader, reader.LocalName); return(true); default: return(false); } }
/// <summary> /// Reads the attributes from XML. /// </summary> /// <param name="reader">The reader.</param> internal override void ReadAttributesFromXml(EwsServiceXmlReader reader) { this.id = reader.ReadAttributeValue(XmlAttributeNames.Id); this.name = reader.ReadAttributeValue(XmlAttributeNames.Name); this.bias = EwsUtilities.XSDurationToTimeSpan(reader.ReadAttributeValue(XmlAttributeNames.Bias)); }
/// <summary> /// Parses the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns>TimeSpan value.</returns> internal override object Parse(string value) { return(EwsUtilities.XSDurationToTimeSpan(value)); }