Esempio n. 1
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);
        }
        /// <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)
            {
                CloudFile cloudFile = this.GetFileReference(file.Name);
                cloudFile.Properties = file.Properties;
                cloudFile.attributes = file.Attributes;

                return(cloudFile);
            }

            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);
        }