Exemple #1
0
        /// <summary>
        /// Reads service properties from a stream.
        /// </summary>
        /// <param name="inputStream">The stream from which to read the service properties.</param>
        /// <returns>The service properties stored in the stream.</returns>
        public static FileServiceProperties ReadServiceProperties(Stream inputStream)
        {
            using (XmlReader reader = XmlReader.Create(inputStream))
            {
                XDocument servicePropertyDocument = XDocument.Load(reader);

                return(FileServiceProperties.FromServiceXml(servicePropertyDocument));
            }
        }
Exemple #2
0
        /// <summary>
        /// Reads service properties from a stream.
        /// </summary>
        /// <param name="inputStream">The stream from which to read the service properties.</param>
        /// <returns>The service properties stored in the stream.</returns>
        public static Task <FileServiceProperties> ReadServicePropertiesAsync(Stream inputStream, CancellationToken token)
        {
            return(Task.Run(
                       () =>
            {
                using (XmlReader reader = XmlReader.Create(inputStream))
                {
                    XDocument servicePropertyDocument = XDocument.Load(reader);

                    return FileServiceProperties.FromServiceXml(servicePropertyDocument);
                }
            },
                       token
                       ));
        }