public void FsTrim() { AllocationTable.FsTrim(); foreach (DirectoryEntry file in this.EnumerateEntries("*", SearchOptions.RecurseSubdirectories)) { if (FileTable.TryOpenFile(file.FullPath, out SaveFileInfo fileInfo) && fileInfo.StartBlock >= 0) { AllocationTable.FsTrimList(fileInfo.StartBlock); OpenFatStorage(fileInfo.StartBlock).Slice(fileInfo.Length).Fill(SaveDataFileSystem.TrimFillValue); } } int freeIndex = AllocationTable.GetFreeListBlockIndex(); if (freeIndex == 0) { return; } AllocationTable.FsTrimList(freeIndex); OpenFatStorage(freeIndex).Fill(SaveDataFileSystem.TrimFillValue); FileTable.TrimFreeEntries(); }