Пример #1
0
        /// <summary>
        /// Reads service stats from a stream.
        /// </summary>
        /// <param name="inputStream">The stream from which to read the service stats.</param>
        /// <returns>The service stats stored in the stream.</returns>
        internal static ServiceStats ReadServiceStats(Stream inputStream)
        {
            using (XmlReader reader = XmlReader.Create(inputStream))
            {
                XDocument serviceStatsDocument = XDocument.Load(reader);

                return(ServiceStats.FromServiceXml(serviceStatsDocument));
            }
        }
        /// <summary>
        /// Reads service stats from a stream.
        /// </summary>
        /// <param name="inputStream">The stream from which to read the service stats.</param>
        /// <returns>The service stats stored in the stream.</returns>
        internal static Task <ServiceStats> ReadServiceStatsAsync(Stream inputStream, CancellationToken token)
        {
            return(Task.Run(
                       () =>
            {
                using (XmlReader reader = XmlReader.Create(inputStream))
                {
                    XDocument serviceStatsDocument = XDocument.Load(reader);

                    return ServiceStats.FromServiceXml(serviceStatsDocument);
                }
            },
                       token
                       ));
        }