Exemplo n.º 1
0
        /// <summary>
        ///     Put a randomly-sized content from a file into the store.
        /// </summary>
        public static async Task <PutResult> PutRandomFileAsync(
            this IContentSession session,
            Context context,
            IAbsFileSystem fileSystem,
            HashType hashType,
            bool provideHash,
            long size,
            CancellationToken ct)
        {
            Contract.RequiresNotNull(session);
            Contract.RequiresNotNull(context);
            Contract.RequiresNotNull(fileSystem);

            using (var directory = new DisposableDirectory(fileSystem))
            {
                var path = directory.CreateRandomFileName();
                return(await session.PutRandomFileAsync(context, fileSystem, path, hashType, provideHash, size, ct));
            }
        }