// // Copyright (c) 2008-2011, Kenneth Bell // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // namespace DiscUtils.Ntfs { using DiscUtils.Compression; /// /// Class whose instances hold options controlling how works. /// public sealed class NtfsOptions : DiscFileSystemOptions { private bool _hideMetaFiles; private bool _hideHiddenFiles; private bool _hideSystemFiles; private bool _hideDosFileNames; private ShortFileNameOption _shortNameCreation; private BlockCompressor _compressor; private bool _readCache; private bool _fileLengthFromDirectoryEntries; internal NtfsOptions() { _hideMetaFiles = true; _hideHiddenFiles = true; _hideSystemFiles = true; _hideDosFileNames = true; _compressor = new LZNT1(); _readCache = true; _fileLengthFromDirectoryEntries = true; } /// /// Gets or sets a value indicating whether to include file system meta-files when enumerating directories. /// /// Meta-files are those with an MFT (Master File Table) index less than 24. public bool HideMetafiles { get { return _hideMetaFiles; } set { _hideMetaFiles = value; } } /// /// Gets or sets a value indicating whether to include hidden files when enumerating directories. /// public bool HideHiddenFiles { get { return _hideHiddenFiles; } set { _hideHiddenFiles = value; } } /// /// Gets or sets a value indicating whether to include system files when enumerating directories. /// public bool HideSystemFiles { get { return _hideSystemFiles; } set { _hideSystemFiles = value; } } /// /// Gets or sets a value indicating whether to hide DOS (8.3-style) file names when enumerating directories. /// public bool HideDosFileNames { get { return _hideDosFileNames; } set { _hideDosFileNames = value; } } /// /// Gets or sets a value indicating whether short (8.3) file names are created automatically. /// public ShortFileNameOption ShortNameCreation { get { return _shortNameCreation; } set { _shortNameCreation = value; } } /// /// Gets or sets the compression algorithm used for compressing files. /// public BlockCompressor Compressor { get { return _compressor; } set { _compressor = value; } } /// /// Gets or sets a value indicating whether NTFS-level read caching is used. /// public bool ReadCacheEnabled { get { return _readCache; } set { _readCache = value; } } /// /// Gets or sets a value indicating whether file length information comes from directory entries or file data. /// /// /// The default (true) is that file length information is supplied by the directory entry /// for a file. In some circumstances that information may be inaccurate - specifically for files with multiple /// hard links, the directory entries are only updated for the hard link used to open the file. /// Setting this value to false, will always retrieve the latest information from the underlying /// NTFS attribute information, which reflects the true size of the file. /// public bool FileLengthFromDirectoryEntries { get { return _fileLengthFromDirectoryEntries; } set { _fileLengthFromDirectoryEntries = value; } } /// /// Returns a string representation of the file system options. /// /// A string of the form Show: XX XX XX. public override string ToString() { return "Show: Normal " + (HideMetafiles ? string.Empty : "Meta ") + (HideHiddenFiles ? string.Empty : "Hidden ") + (HideSystemFiles ? string.Empty : "System ") + (HideDosFileNames ? string.Empty : "ShortNames "); } } }