/// <summary>
        /// Reads share stats from a stream.
        /// </summary>
        /// <param name="inputStream">The stream from which to read the share stats.</param>
        /// <returns>The share stats stored in the stream.</returns>
        public static ShareStats ReadShareStats(Stream inputStream)
        {
            using (XmlReader reader = XmlReader.Create(inputStream))
            {
                XDocument shareStatsDocument = XDocument.Load(reader);

                return(ShareStats.FromServiceXml(shareStatsDocument));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads share stats from a stream.
        /// </summary>
        /// <param name="inputStream">The stream from which to read the share stats.</param>
        /// <returns>The share stats stored in the stream.</returns>
        public static Task <ShareStats> ReadShareStatsAsync(Stream inputStream, CancellationToken token)
        {
            return(Task.Run(
                       () =>
            {
                using (XmlReader reader = XmlReader.Create(inputStream))
                {
                    XDocument shareStatsDocument = XDocument.Load(reader);

                    return ShareStats.FromServiceXml(shareStatsDocument);
                }
            },
                       token
                       ));
        }