Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ RemoveDirectoryRecursive()

static void System.IO.FileSystem.RemoveDirectoryRecursive ( string fullPath,
ref Interop::Kernel32::WIN32_FIND_DATA findData,
bool topLevel )
inlinestaticprivate

Definition at line 408 of file FileSystem.cs.

409 {
410 Exception ex = null;
412 {
413 if (safeFindHandle.IsInvalid)
414 {
415 throw Win32Marshal.GetExceptionForLastWin32Error(fullPath);
416 }
417 int lastWin32Error;
418 do
419 {
420 if ((findData.dwFileAttributes & 0x10) == 0)
421 {
422 string stringFromFixedBuffer = findData.cFileName.GetStringFromFixedBuffer();
424 {
426 if (lastWin32Error != 2)
427 {
428 ex = Win32Marshal.GetExceptionForWin32Error(lastWin32Error, stringFromFixedBuffer);
429 }
430 }
431 }
432 else
433 {
434 if (findData.cFileName.FixedBufferEqualsString(".") || findData.cFileName.FixedBufferEqualsString(".."))
435 {
436 continue;
437 }
438 string stringFromFixedBuffer2 = findData.cFileName.GetStringFromFixedBuffer();
440 {
441 try
442 {
444 }
445 catch (Exception ex2)
446 {
447 if (ex == null)
448 {
449 ex = ex2;
450 }
451 }
452 continue;
453 }
454 if (findData.dwReserved0 == 2684354563u)
455 {
456 string mountPoint = Path.Join(fullPath, stringFromFixedBuffer2, "\\");
458 {
460 if (lastWin32Error != 0 && lastWin32Error != 3)
461 {
462 ex = Win32Marshal.GetExceptionForWin32Error(lastWin32Error, stringFromFixedBuffer2);
463 }
464 }
465 }
467 {
469 if (lastWin32Error != 3)
470 {
471 ex = Win32Marshal.GetExceptionForWin32Error(lastWin32Error, stringFromFixedBuffer2);
472 }
473 }
474 }
475 }
477 if (ex != null)
478 {
479 throw ex;
480 }
482 if (lastWin32Error != 0 && lastWin32Error != 18)
483 {
484 throw Win32Marshal.GetExceptionForWin32Error(lastWin32Error, fullPath);
485 }
486 }
488 }
static bool RemoveDirectory(string path)
Definition Interop.cs:1009
static bool DeleteFile(string path)
Definition Interop.cs:750
static bool DeleteVolumeMountPoint(string mountPoint)
Definition Interop.cs:759
static bool FindNextFile(SafeFindHandle hndFindFile, ref WIN32_FIND_DATA lpFindFileData)
static Microsoft.Win32.SafeHandles.SafeFindHandle FindFirstFile(string fileName, ref WIN32_FIND_DATA data)
Definition Interop.cs:117
static bool IsNameSurrogateReparsePoint(ref Interop.Kernel32.WIN32_FIND_DATA data)
static void RemoveDirectoryInternal(string fullPath, bool topLevel, bool allowDirectoryNotEmpty=false)
static void RemoveDirectoryRecursive(string fullPath, ref Interop.Kernel32.WIN32_FIND_DATA findData, bool topLevel)

References System.IO.Path.Combine(), Interop.Kernel32.DeleteFile(), Interop.Kernel32.DeleteVolumeMountPoint(), Interop.Kernel32.FindFirstFile(), Interop.Kernel32.FindNextFile(), System.IO.Win32Marshal.GetExceptionForLastWin32Error(), System.IO.Win32Marshal.GetExceptionForWin32Error(), System.Runtime.InteropServices.Marshal.GetLastWin32Error(), System.IO.FileSystem.IsNameSurrogateReparsePoint(), System.IO.Path.Join(), Interop.Kernel32.RemoveDirectory(), System.IO.FileSystem.RemoveDirectoryInternal(), and System.IO.FileSystem.RemoveDirectoryRecursive().

Referenced by System.IO.FileSystem.RemoveDirectory(), and System.IO.FileSystem.RemoveDirectoryRecursive().