Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileProperties"/> class based on an existing instance.
        /// </summary>
        /// <param name="other">The set of file properties to clone.</param>
        public FileProperties(FileProperties other)
        {
            CommonUtility.AssertNotNull("other", other);

            this.ContentType        = other.ContentType;
            this.ContentDisposition = other.ContentDisposition;
            this.ContentEncoding    = other.ContentEncoding;
            this.ContentLanguage    = other.ContentLanguage;
            this.CacheControl       = other.CacheControl;
            this.ContentMD5         = other.ContentMD5;
            this.Length             = other.Length;
            this.ETag         = other.ETag;
            this.LastModified = other.LastModified;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileReadStreamBase"/> class.
        /// </summary>
        /// <param name="file">File reference to read from</param>
        /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the access conditions for the file. If <c>null</c>, no condition is used.</param>
        /// <param name="options">An <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
        protected FileReadStreamBase(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)
        {
            if (options.UseTransactionalMD5.Value)
            {
                CommonUtility.AssertInBounds("StreamMinimumReadSizeInBytes", file.StreamMinimumReadSizeInBytes, 1, Constants.MaxRangeGetContentMD5Size);
            }

            this.file           = file;
            this.fileProperties = new FileProperties(file.Properties);
            this.currentOffset  = 0;
            this.streamMinimumReadSizeInBytes = this.file.StreamMinimumReadSizeInBytes;
            this.internalBuffer   = new MultiBufferMemoryStream(file.ServiceClient.BufferManager);
            this.accessCondition  = accessCondition;
            this.options          = options;
            this.operationContext = operationContext;
            this.fileMD5          = (this.options.DisableContentMD5Validation.Value || string.IsNullOrEmpty(this.fileProperties.ContentMD5)) ? null : new MD5Wrapper();
            this.lastException    = null;
        }