コード例 #1
0
ファイル: HashService.cs プロジェクト: tiger2soft/bbv.Common
        /// <summary>
        /// Computes the hash value from the content of a file.
        /// </summary>
        /// <param name="reader">The reader for the input data.</param>
        /// <returns>Hash as a hex-string.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        public string GetHashFromReader(ITextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            using (Stream stream = reader.GetStream())
            {
                return this.algorithm.ComputeHashFromStream(stream);
            }
        }
コード例 #2
0
ファイル: HashService.cs プロジェクト: ursenzler/bbv.Common
        /// <summary>
        /// Computes the hash value from the content of a file.
        /// </summary>
        /// <param name="reader">The reader for the input data.</param>
        /// <returns>Hash as a hex-string.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        public string GetHashFromReader(ITextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            using (Stream stream = reader.GetStream())
            {
                return(this.algorithm.ComputeHashFromStream(stream));
            }
        }