Exemple #1
0
        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];
        }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
        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;
        }
Exemple #4
0
        /// <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();
        }