using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; namespace Umbraco.Core.Deploy { /// /// Represents a file source, ie a mean for a target environment involved in a /// deployment to obtain the content of files being deployed. /// public interface IFileSource { /// /// Gets the content of a file as a stream. /// /// A file entity identifier. /// A stream with read access to the file content. /// /// Returns null if no content could be read. /// The caller should ensure that the stream is properly closed/disposed. /// Stream GetFileStream(StringUdi udi); /// /// Gets the content of a file as a stream. /// /// A file entity identifier. /// A cancellation token. /// A stream with read access to the file content. /// /// Returns null if no content could be read. /// The caller should ensure that the stream is properly closed/disposed. /// Task GetFileStreamAsync(StringUdi udi, CancellationToken token); /// /// Gets the content of a file as a string. /// /// A file entity identifier. /// A string containing the file content. /// Returns null if no content could be read. string GetFileContent(StringUdi udi); /// /// Gets the content of a file as a string. /// /// A file entity identifier. /// A cancellation token. /// A string containing the file content. /// Returns null if no content could be read. Task GetFileContentAsync(StringUdi udi, CancellationToken token); /// /// Gets the length of a file. /// /// A file entity identifier. /// The length of the file, or -1 if the file does not exist. long GetFileLength(StringUdi udi); /// /// Gets the length of a file. /// /// A file entity identifier. /// A cancellation token. /// The length of the file, or -1 if the file does not exist. Task GetFileLengthAsync(StringUdi udi, CancellationToken token); /// /// Gets files and store them using a file store. /// /// The udis of the files to get. /// A collection of file types which can store the files. void GetFiles(IEnumerable udis, IFileTypeCollection fileTypes); /// /// Gets files and store them using a file store. /// /// The udis of the files to get. /// A collection of file types which can store the files. /// A cancellation token. Task GetFilesAsync(IEnumerable udis, IFileTypeCollection fileTypes, CancellationToken token); ///// ///// Gets the content of a file as a bytes array. ///// ///// A file entity identifier. ///// A byte array containing the file content. //byte[] GetFileBytes(StringUdi Udi); } }