/// <summary>
        /// Initializes a new instance of the <see cref="CloudFile"/> class.
        /// </summary>
        /// <param name="attributes">The attributes.</param>
        /// <param name="serviceClient">The service client.</param>
        internal CloudFile(CloudFileAttributes attributes, CloudFileClient serviceClient)
        {
            this.attributes    = attributes;
            this.ServiceClient = serviceClient;

            this.ParseQueryAndVerify(this.StorageUri, this.ServiceClient.Credentials);
        }
Exemple #2
0
        /// <summary>
        /// Selects the protocol response.
        /// </summary>
        /// <param name="protocolItem">The protocol item.</param>
        /// <returns>The parsed <see cref="IListFileItem"/>.</returns>
        private IListFileItem SelectListFileItem(IListFileEntry protocolItem)
        {
            ListFileEntry file = protocolItem as ListFileEntry;

            if (file != null)
            {
                CloudFileAttributes attributes = file.Attributes;
                attributes.StorageUri = NavigationHelper.AppendPathToUri(this.StorageUri, file.Name);
                return(new CloudFile(attributes, this.ServiceClient));
            }

            ListFileDirectoryEntry fileDirectory = protocolItem as ListFileDirectoryEntry;

            if (fileDirectory != null)
            {
                CloudFileDirectory directory = this.GetDirectoryReference(fileDirectory.Name);
                directory.Properties = fileDirectory.Properties;
                return(directory);
            }

            throw new InvalidOperationException(SR.InvalidFileListItem);
        }