Exemple #1
0
        /// <summary>
        /// Constructs a <c>ServiceStats</c> object from an XML document received from the service.
        /// </summary>
        /// <param name="serviceStatsDocument">The XML document.</param>
        /// <returns>A <c>ServiceStats</c> object containing the properties in the XML document.</returns>
        internal static ServiceStats FromServiceXml(XDocument serviceStatsDocument)
        {
            XElement serviceStatsElement = serviceStatsDocument.Element(StorageServiceStatsName);

            return(new ServiceStats()
            {
                GeoReplication = GeoReplicationStats.ReadGeoReplicationStatsFromXml(serviceStatsElement.Element(GeoReplicationName)),
            });
        }
        /// <summary>
        /// Constructs a <c>GeoReplicationStats</c> object from an XML element.
        /// </summary>
        /// <param name="element">The XML element.</param>
        /// <returns>A <c>GeoReplicationStats</c> object containing the properties in the element.</returns>
        internal static GeoReplicationStats ReadGeoReplicationStatsFromXml(XElement element)
        {
            string lastSyncTime = element.Element(LastSyncTimeName).Value;

            return(new GeoReplicationStats()
            {
                Status = GeoReplicationStats.GetGeoReplicationStatus(element.Element(StatusName).Value),
                LastSyncTime = string.IsNullOrEmpty(lastSyncTime) ? (DateTimeOffset?)null : DateTimeOffset.Parse(lastSyncTime, CultureInfo.InvariantCulture),
            });
        }