using System.Collections.Generic; using System.IO; namespace Chernobyl { /// /// An interface for working with types that are used to hold several /// file/folder paths for so that other systems can search these paths for /// files, folders, etc. Derived types will automatically convert all '\' to /// '/' for cross platform purposes. /// public interface ISearchPaths : ICollection { /// /// Searches the search paths for a file that matches the search pattern /// and returns a FileStream (for reading only) to that file or null if /// no file could be found. Only the first file found is returned. This /// method does not search subdirectories. /// /// The pattern to look for when searching /// for the file. See the search pattern parameter on /// for more information on /// this parameter /// Specifies how the file should be opened. /// The FileStream to the found file or null if no file could /// be found. FileStream Find(string searchPattern, FileMode fileMode); /// /// Searches the search paths for a file that matches the search pattern /// and returns a FileStream (for reading only) to that file or null if /// no file could be found. /// /// The pattern to look for when searching /// for the file. See the search pattern parameter on /// for more information on /// this parameter /// Specifies how each of the search paths /// should be searched. See the searchOptions parameter on /// for more information. /// Specifies how the file should be opened. /// The FileStream to the found file or null if no file could /// be found. FileStream Find(string searchPattern, SearchOption searchOptions, FileMode fileMode); /// /// Searches the search paths for a file that matches the search pattern /// and returns a FileStream to that file or null if no file could be /// found. /// /// The pattern to look for when searching /// for the file. See the search pattern parameter on /// for more information on /// this parameter /// Specifies how each of the search paths /// should be searched. See the searchOptions parameter on /// for more information. /// Specifies how the file should be opened. /// Specifies what operations you want to do on /// the file. /// The FileStream to the found file or null if no file could /// be found. FileStream Find(string searchPattern, SearchOption searchOptions, FileMode fileMode, FileAccess fileAccess); /// /// Returns the first path to the file specified. /// /// The name of the file to look for. /// The path to the file specified. string FindFilePath(string file); /// /// Returns an enumerator of file paths that are contained /// in this SearchPath. Only paths to files that actually /// exist are returned. /// /// A string that should be /// appended to the end of the contained file paths before they /// are searched for existence. /// An enumerator of paths to files that exist. IEnumerable FilePaths(string filepathAppendage); /// /// Returns an enumerator of file paths that are contained /// in this SearchPath. Only paths to files that actually /// exist are returned. /// /// An enumerator of paths to files that exist. IEnumerable FilePaths(); /// /// Returns an enumerator of folder paths that are contained /// in this SearchPath. Only paths to folders that actually /// exist are returned. /// /// A string that should be /// appended to the end of the contained folder paths before they /// are searched for existence. /// An enumerator of paths to folders that exist. IEnumerable DirectoryPaths(string directorypathAppendage); /// /// Returns an enumerator of folder paths that are contained /// in this SearchPath. Only paths to folders that actually /// exist are returned. /// /// An enumerator of paths to folders that exist. IEnumerable DirectoryPaths(); /// /// Returns an enumeration of FileStreams created /// from search paths in this class. Any FileStreams /// to files which do not exist will not be returned. /// /// A string that should be appended /// to the front of each of the SearchPaths before they are checked for /// existence or created. /// The FileMode to open the files with. /// An enumeration of FileStreams which point to the files /// pointed to by the search paths. IEnumerable Files(FileMode fileMode, string filepathAppendage); /// /// Returns an enumeration of FileStreams created /// from search paths in this class. Any FileStreams /// to files which do not exist will not be returned. /// /// The FileMode to open the files with. /// An enumeration of FileStreams which point to the files /// pointed to by the search paths. IEnumerable Files(FileMode fileMode); } }