internal ClusterStream(FatFileSystem fileSystem, FileAccess access, uint firstCluster, uint length) { _access = access; _reader = fileSystem.ClusterReader; _fat = fileSystem.Fat; _length = length; _knownClusters = new List<uint>(); if (firstCluster != 0) { _knownClusters.Add(firstCluster); } else { _knownClusters.Add(FatBuffer.EndOfChain); } if (_length == uint.MaxValue) { _length = DetectLength(); } _currentCluster = uint.MaxValue; _clusterBuffer = new byte[_reader.ClusterSize]; }
/// <summary> /// Initializes a new instance of the Directory class. Use this constructor to represent the root directory. /// </summary> /// <param name="fileSystem">The file system</param> /// <param name="dirStream">The stream containing the directory info</param> internal Directory(FatFileSystem fileSystem, Stream dirStream) { _fileSystem = fileSystem; _dirStream = dirStream; LoadEntries(); }
public FatFileStream(FatFileSystem fileSystem, Directory dir, long fileId, FileAccess access) { _dir = dir; _dirId = fileId; DirectoryEntry dirEntry = _dir.GetEntry(_dirId); _stream = new ClusterStream(fileSystem, access, (uint)dirEntry.FirstCluster, (uint)dirEntry.FileSize); _stream.FirstClusterChanged += FirstClusterAllocatedHandler; }
/// <summary> /// Initializes a new instance of the Directory class. Use this constructor to represent non-root directories. /// </summary> /// <param name="parent">The parent directory</param> /// <param name="parentId">The identity of the entry representing this directory in the parent</param> internal Directory(Directory parent, long parentId) { _fileSystem = parent._fileSystem; _parent = parent; _parentId = parentId; DirectoryEntry dirEntry = ParentsChildEntry; _dirStream = new ClusterStream(_fileSystem, FileAccess.ReadWrite, dirEntry.FirstCluster, uint.MaxValue); LoadEntries(); }