public override DirectoryEntry GetRootDirectory() { Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.GetRootDirectory --"); var xRootEntry = new FatDirectoryEntry(this, null, mRootPath, mSize, mRootPath, RootCluster); return(xRootEntry); }
public override DirectoryEntry GetRootDirectory() { FileSystemHelpers.Debug("FatFileSystem.GetRootDirectory", "RootCluster =" + RootCluster); var xRootEntry = new FatDirectoryEntry(this, null, mRootPath, RootCluster); return(xRootEntry); }
public FatStream(FatDirectoryEntry aEntry) { mDirectoryEntry = aEntry; mFS = mDirectoryEntry.GetFileSystem(); mSize = mDirectoryEntry.mSize; if (mDirectoryEntry.mSize > 0) { mFatTable = mDirectoryEntry.GetFatTable(); } }
public FatStream(FatDirectoryEntry aEntry) { mDirectoryEntry = aEntry ?? throw new ArgumentNullException(nameof(aEntry)); mFS = aEntry.GetFileSystem(); mFatTable = aEntry.GetFatTable(); mSize = aEntry.mSize; if (mFatTable == null) { throw new Exception("The fat chain returned for the directory entry was null."); } }
public FatStream(FatDirectoryEntry aEntry) { Global.mFileSystemDebugger.SendInternal("FatStream with entry " + aEntry); mDirectoryEntry = aEntry; mFS = mDirectoryEntry.GetFileSystem(); mSize = mDirectoryEntry.mSize; if (mDirectoryEntry.mSize > 0) { mFatTable = mDirectoryEntry.GetFatTable(); } }
public FatStream(FatDirectoryEntry aEntry) { Global.mFileSystemDebugger.SendInternal("FatStream.Ctor"); mDirectoryEntry = aEntry; mFS = mDirectoryEntry.GetFileSystem(); mSize = mDirectoryEntry.mSize; Global.mFileSystemDebugger.SendInternal("mSize ="); Global.mFileSystemDebugger.SendInternal(mSize.ToString()); // We get always the FatTable if the file is empty too mFatTable = mDirectoryEntry.GetFatTable(); // What to do if this should happen? Throw exception? if (mFatTable == null) { Global.mFileSystemDebugger.SendInternal("FatTable got but it is null!"); } }
public override void EraseDirectoryStructures(VolumeInfo info, FileSystemEntriesEraseProgress callback) { using (FileStream stream = info.Open(FileAccess.ReadWrite, FileShare.ReadWrite)) using (FatApi api = GetFatApi(info, stream)) { int directoriesCleaned = 0; HashSet <uint> eraseQueueClusters = new HashSet <uint>(); List <FatDirectoryEntry> eraseQueue = new List <FatDirectoryEntry>(); try { { FatDirectoryEntry entry = api.LoadDirectory(string.Empty); eraseQueue.Add(entry); eraseQueueClusters.Add(entry.Cluster); } while (eraseQueue.Count != 0) { if (callback != null) { callback(directoriesCleaned, directoriesCleaned + eraseQueue.Count); } FatDirectoryBase currentDir = api.LoadDirectory(eraseQueue[0].FullName); eraseQueue[0].Dispose(); eraseQueue.RemoveAt(0); //Queue the subfolders in this directory foreach (KeyValuePair <string, FatDirectoryEntry> entry in currentDir.Items) { if (entry.Value.EntryType == FatDirectoryEntryType.Directory) { //Check that we don't have the same cluster queued twice (e.g. for //long/8.3 file names) if (eraseQueueClusters.Contains(entry.Value.Cluster)) { continue; } eraseQueueClusters.Add(entry.Value.Cluster); eraseQueue.Add(entry.Value); } } currentDir.ClearDeletedEntries(); ++directoriesCleaned; } } catch (SharingViolationException) { Logger.Log(S._("Could not erase directory entries on the volume {0} because " + "the volume is currently in use.")); } finally { foreach (FatDirectoryEntry entry in eraseQueue) { entry.Dispose(); } } } }