예제 #1
0
        /// <summary>
        /// Constructs a BlobSignatureItem object with the specified parameters.
        /// </summary>
        /// <param name="name">The name of the item</param>
        /// <param name="contentType">The type of the item</param>
        /// <param name="hashInfo">The hash information for the BLOB</param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="name"/> or <paramref name="contentType"/> are <b>null</b>.
        /// </exception>
        internal BlobSignatureItem(string name, string contentType, BlobHashInfo hashInfo)
        {
            Validator.ThrowIfArgumentNull(name, nameof(name), Resources.ArgumentNull);
            Validator.ThrowIfArgumentNull(contentType, nameof(contentType), Resources.ArgumentNull);

            Name        = name;
            ContentType = contentType;
            HashInfo    = hashInfo;
        }
        /// <summary>
        /// Constructs an instance of the Blob class with the specified values.
        /// </summary>
        ///
        /// <param name="name">
        /// The name of the BLOB. It can be <see cref="string.Empty"/> but cannot be <b>null</b>.
        /// </param>
        ///
        /// <param name="contentType">
        /// The content type of the BLOB.
        /// </param>
        ///
        /// <param name="currentContentEncoding">
        /// The current content encoding of the BLOB or <b>null</b> if the BLOB is not encoded.
        /// </param>
        ///
        /// <param name="legacyContentEncoding">
        /// The previous content encoding of the BLOB (if any).
        /// </param>
        ///
        /// <param name="hashInfo">
        /// The hash information for the BLOB.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="name"/> or <paramref name="contentType"/> is <b>null</b>.
        /// </exception>
        ///
        internal Blob(
            string name,
            string contentType,
            string currentContentEncoding,
            string legacyContentEncoding,
            BlobHashInfo hashInfo)
        {
            Validator.ThrowIfArgumentNull(name, nameof(name), Resources.StringNull);
            Validator.ThrowIfArgumentNull(contentType, nameof(contentType), Resources.StringNull);

            Name                  = name;
            ContentType           = contentType;
            ContentEncoding       = currentContentEncoding;
            LegacyContentEncoding = legacyContentEncoding;
            HashInfo              = hashInfo;
        }
        private void WriteNewInlineData(byte[] bytes)
        {
            BlobHasher inlineHasher = BlobHasher.InlineBlobHasher;

            byte[] blobHash = inlineHasher.CalculateBlobHash(bytes, 0, bytes.Length);

            Url           = null;
            InlineData    = bytes;
            ContentLength = bytes.Length;

            HashInfo = new BlobHashInfo(
                inlineHasher.BlobHashAlgorithm,
                inlineHasher.BlockSize,
                blobHash);

            IsDirty = true;
        }