Changeset 2728
- Timestamp:
- 6/28/2012 12:11:48 AM (11 months ago)
- Location:
- branches/eraser6/6.0
- Files:
-
- 5 edited
-
Eraser.DefaultPlugins/FileSystems/Fat.cs (modified) (1 diff)
-
Eraser.Util.FileSystem/Fat12Or16Api.cpp (modified) (2 diffs)
-
Eraser.Util.FileSystem/Fat32Api.cpp (modified) (1 diff)
-
Eraser.Util.FileSystem/FatApi.cpp (modified) (2 diffs)
-
Eraser.Util.FileSystem/FatApi.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/6.0/Eraser.DefaultPlugins/FileSystems/Fat.cs
r1677 r2728 75 75 { 76 76 using (FileStream stream = info.Open(FileAccess.ReadWrite, FileShare.ReadWrite)) 77 using (FatApi api = GetFatApi(info, stream)) 77 78 { 78 79 int directoriesCleaned = 0; 79 FatApi api = GetFatApi(info, stream);80 80 HashSet<uint> eraseQueueClusters = new HashSet<uint>(); 81 81 List<FatDirectoryEntry> eraseQueue = new List<FatDirectoryEntry>(); 82 83 try 82 84 { 83 FatDirectoryEntry entry = api.LoadDirectory(string.Empty); 84 eraseQueue.Add(entry); 85 eraseQueueClusters.Add(entry.Cluster); 85 { 86 FatDirectoryEntry entry = api.LoadDirectory(string.Empty); 87 eraseQueue.Add(entry); 88 eraseQueueClusters.Add(entry.Cluster); 89 } 90 91 using (VolumeLock volumeLock = info.LockVolume(stream)) 92 { 93 while (eraseQueue.Count != 0) 94 { 95 if (callback != null) 96 callback(directoriesCleaned, directoriesCleaned + eraseQueue.Count); 97 98 FatDirectoryBase currentDir = api.LoadDirectory(eraseQueue[0].FullName); 99 eraseQueue.RemoveAt(0); 100 101 //Queue the subfolders in this directory 102 foreach (KeyValuePair<string, FatDirectoryEntry> entry in currentDir.Items) 103 if (entry.Value.EntryType == FatDirectoryEntryType.Directory) 104 { 105 //Check that we don't have the same cluster queued twice (e.g. for 106 //long/8.3 file names) 107 if (eraseQueueClusters.Contains(entry.Value.Cluster)) 108 continue; 109 110 eraseQueueClusters.Add(entry.Value.Cluster); 111 eraseQueue.Add(entry.Value); 112 } 113 114 currentDir.ClearDeletedEntries(); 115 ++directoriesCleaned; 116 } 117 } 86 118 } 87 88 using (VolumeLock volumeLock = info.LockVolume(stream)) 119 finally 89 120 { 90 while (eraseQueue.Count != 0) 91 { 92 if (callback != null) 93 callback(directoriesCleaned, directoriesCleaned + eraseQueue.Count); 94 95 FatDirectoryBase currentDir = api.LoadDirectory(eraseQueue[0].FullName); 96 eraseQueue.RemoveAt(0); 97 98 //Queue the subfolders in this directory 99 foreach (KeyValuePair<string, FatDirectoryEntry> entry in currentDir.Items) 100 if (entry.Value.EntryType == FatDirectoryEntryType.Directory) 101 { 102 //Check that we don't have the same cluster queued twice (e.g. for 103 //long/8.3 file names) 104 if (eraseQueueClusters.Contains(entry.Value.Cluster)) 105 continue; 106 107 eraseQueueClusters.Add(entry.Value.Cluster); 108 eraseQueue.Add(entry.Value); 109 } 110 111 currentDir.ClearDeletedEntries(); 112 ++directoriesCleaned; 113 } 121 foreach (FatDirectoryEntry entry in eraseQueue) 122 entry.Dispose(); 114 123 } 115 124 } -
branches/eraser6/6.0/Eraser.Util.FileSystem/Fat12Or16Api.cpp
r1677 r2728 40 40 if (info->VolumeFormat != L"FAT12" && info->VolumeFormat != "FAT16") 41 41 throw gcnew ArgumentException(L"The volume provided is not a FAT12 or FAT16 volume."); 42 } 43 44 Fat12Or16Api::!Fat12Or16Api() 45 { 46 if (Fat != NULL) 47 { 48 delete[] Fat; 49 Fat = NULL; 50 } 42 51 } 43 52 … … 126 135 } 127 136 137 Fat12Or16Api::RootDirectory::!RootDirectory() 138 { 139 if (Directory != NULL) 140 { 141 delete[] Directory; 142 Directory = NULL; 143 DirectorySize = 0; 144 } 145 } 146 128 147 void Fat12Or16Api::RootDirectory::ReadDirectory() 129 148 { -
branches/eraser6/6.0/Eraser.Util.FileSystem/Fat32Api.cpp
r1677 r2728 40 40 if (info->VolumeFormat != L"FAT32") 41 41 throw gcnew ArgumentException(L"The volume provided is not a FAT32 volume."); 42 } 43 44 Fat32Api::!Fat32Api() 45 { 46 if (Fat != NULL) 47 { 48 delete[] Fat; 49 Fat = NULL; 50 } 42 51 } 43 52 -
branches/eraser6/6.0/Eraser.Util.FileSystem/FatApi.cpp
r1677 r2728 70 70 } 71 71 72 FatApi::!FatApi() 73 { 74 if (BootSector != NULL) 75 { 76 delete BootSector; 77 BootSector = NULL; 78 } 79 } 80 72 81 FatDirectoryBase^ FatApi::LoadDirectory(String^ directory) 73 82 { … … 344 353 } 345 354 355 FatDirectory::!FatDirectory() 356 { 357 if (Directory != NULL) 358 { 359 delete[] Directory; 360 Directory = NULL; 361 DirectorySize = 0; 362 } 363 } 364 346 365 void FatDirectory::ReadDirectory() 347 366 { -
branches/eraser6/6.0/Eraser.Util.FileSystem/FatApi.h
r1677 r2728 46 46 FatApi(VolumeInfo^ info, IO::Stream^ stream); 47 47 48 /// Destructor. 49 virtual ~FatApi() { this->!FatApi(); } 50 51 /// Finalizer. 52 !FatApi(); 53 48 54 public: 49 55 /// Loads the File Allocation Table from disk. … … 147 153 { 148 154 public: 155 virtual ~FatDirectoryEntry() {} 156 157 public: 149 158 /// Gets the name of the file or directory. 150 159 property String^ Name … … 214 223 FatDirectoryBase(String^ name, FatDirectoryBase^ parent, unsigned cluster); 215 224 225 virtual ~FatDirectoryBase() {} 226 216 227 public: 217 228 /// Compacts the directory structure, updating the structure on-disk as well. … … 280 291 FatDirectory(String^ name, FatDirectoryBase^ parent, unsigned cluster, FatApi^ api); 281 292 293 /// Destructor. 294 virtual ~FatDirectory() { this->!FatDirectory(); } 295 296 /// Finalizer. 297 !FatDirectory(); 298 282 299 virtual void ReadDirectory() override; 283 300 virtual void WriteDirectory() override; … … 292 309 Fat12Or16Api(VolumeInfo^ info); 293 310 Fat12Or16Api(VolumeInfo^ info, IO::Stream^ stream); 311 312 virtual ~Fat12Or16Api() { this->!Fat12Or16Api(); } 313 !Fat12Or16Api(); 294 314 295 315 public: … … 307 327 public: 308 328 RootDirectory(Fat12Or16Api^ api); 329 330 virtual ~RootDirectory() { this->!RootDirectory(); } 331 !RootDirectory(); 309 332 310 333 protected: … … 363 386 Fat32Api(VolumeInfo^ info); 364 387 Fat32Api(VolumeInfo^ info, IO::Stream^ stream); 388 389 virtual ~Fat32Api() { this->!Fat32Api(); } 390 !Fat32Api(); 365 391 366 392 public:
Note: See TracChangeset
for help on using the changeset viewer.
