Beispiel #1
0
        /// <summary>
        /// Creates or updates a given file resource in the file system.
        /// </summary>
        /// <param name="writeContract">Provides required information about the
        /// file to be created along with the data to be written.</param>
        /// <exception cref="ResourceAccessException">In case of invalid or prohibited
        /// resource access.</exception>
        /// <exception cref="VirtualResourceNotFoundException">If the parent folder
        /// of the submitted file path does not exist.</exception>
        /// <exception cref="ResourceOverwriteException">If a file already exists at the
        /// specified location, and the <see cref="WriteFileDataContract.Overwrite"/> flag was not set.</exception>
        /// <exception cref="ArgumentNullException">If any of the parameters is a null reference.</exception>
        public FileInfoDataContract WriteFile(WriteFileDataContract writeContract)
        {
            var fileInfo = FaultUtil.SecureFunc(FileSystemTask.StreamedFileUploadRequest, () => Decorated.WriteFile(
                                                    writeContract.FilePath,
                                                    writeContract.Data,
                                                    writeContract.Overwrite,
                                                    writeContract.ResourceLength,
                                                    writeContract.ContentType));

            return(new FileInfoDataContract {
                FileInfo = fileInfo
            });
        }
 /// <summary>
 /// Creates or updates a given file resource in the file system.
 /// </summary>
 /// <param name="writeContract">Provides required information about the
 /// file to be created along with the data to be written.</param>
 /// <exception cref="ResourceAccessException">In case of invalid or prohibited
 /// resource access.</exception>
 /// <exception cref="VirtualResourceNotFoundException">If the parent folder
 /// of the submitted file path does not exist.</exception>
 /// <exception cref="ResourceOverwriteException">If a file already exists at the
 /// specified location, and the <see cref="WriteFileDataContract.Overwrite"/> flag was not set.</exception>
 /// <exception cref="ArgumentNullException">If any of the parameters is a null reference.</exception>
 public FileInfoDataContract WriteFile(WriteFileDataContract writeContract)
 {
   var fileInfo = FaultUtil.SecureFunc(FileSystemTask.StreamedFileUploadRequest, () => Decorated.WriteFile(
                                                                                         writeContract.FilePath,
                                                                                         writeContract.Data,
                                                                                         writeContract.Overwrite,
                                                                                         writeContract.ResourceLength,
                                                                                         writeContract.ContentType));
   return new FileInfoDataContract { FileInfo = fileInfo };
 }