8internal static class FileSystem
73 data.PopulateFrom(
ref data2);
80 data.dwFileAttributes = -1;
151 sECURITY_ATTRIBUTES.lpSecurityDescriptor = (
IntPtr)
ptr;
153 while (
list.Count > 0)
173 if (
count == 0 && !flag)
401 if ((data.dwFileAttributes & 0
x400u) != 0)
403 return (data.dwReserved0 & 0
x20000000) != 0;
434 if (
findData.cFileName.FixedBufferEqualsString(
".") ||
findData.cFileName.FixedBufferEqualsString(
".."))
541 fILE_BASIC_INFO.FileAttributes = fileAttributes;
629 if (
value.ReparseTag == 2684354572
u)
634 if ((
value.Flags & 1) == 0)
636 if (
span2.StartsWith(
"\\??\\UNC\\".AsSpan()))
638 return Path.
Join(
"\\\\".AsSpan(),
span2.Slice(
"\\??\\UNC\\".Length));
646 return span2.ToString();
648 if (
value.ReparseTag == 2684354563
u)
665 return targetPath.Slice(
"\\??\\".Length).ToString();
673 if ((
findData.dwFileAttributes & 0
x400) == 0 || (findData.dwReserved0 != 2684354572
u && findData.dwReserved0 != 2684354563
u))
692 if (num >
array.Length)
714 string result =
null;
static bool EncryptFile(string path)
static bool DecryptFile(string path)
static bool ReplaceFile(string replacedFileName, string replacementFileName, string backupFileName, int dwReplaceFlags, IntPtr lpExclude, IntPtr lpReserved)
static unsafe bool GetVolumeInformation(string drive, char *volumeName, int volumeNameBufLen, int *volSerialNumber, int *maxFileNameLen, out int fileSystemFlags, char *fileSystemName, int fileSystemNameBufLen)
static bool RemoveDirectory(string path)
static unsafe SafeFileHandle CreateFile(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES *lpSecurityAttributes, FileMode dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile)
static int CopyFile(string src, string dst, bool failIfExists)
static bool MoveFile(string src, string dst, bool overwrite)
static bool DeleteFile(string path)
static unsafe bool SetFileInformationByHandle(SafeFileHandle hFile, int FileInformationClass, void *lpFileInformation, uint dwBufferSize)
static bool GetFileAttributesEx(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation)
static bool CreateDirectory(string path, ref SECURITY_ATTRIBUTES lpSecurityAttributes)
static bool DeleteVolumeMountPoint(string mountPoint)
static bool SetFileAttributes(string name, int attr)
static bool FindNextFile(SafeFindHandle hndFindFile, ref WIN32_FIND_DATA lpFindFileData)
static bool DeviceIoControl(SafeHandle hDevice, uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, byte[] lpOutBuffer, uint nOutBufferSize, out uint lpBytesReturned, IntPtr lpOverlapped)
static void CreateSymbolicLink(string symlinkFileName, string targetFileName, bool isDirectory)
static Microsoft.Win32.SafeHandles.SafeFindHandle FindFirstFile(string fileName, ref WIN32_FIND_DATA data)
static unsafe uint GetFinalPathNameByHandle(SafeFileHandle hFile, char *lpszFilePath, uint cchFilePath, uint dwFlags)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static string GetDirectoryRoot(string path)
static string[] GetLogicalDrives()
static string NormalizeDriveName(string driveName)
static unsafe void ThrowExceptionEncryptDecryptFail(string fullPath)
static bool DirectoryExists(string fullPath)
static string GetFinalLinkTarget(string linkPath, bool isDirectory)
static unsafe void CreateDirectory(string fullPath, byte[] securityDescriptor=null)
static DateTimeOffset GetLastAccessTime(string fullPath)
static void DeleteFile(string fullPath)
static unsafe string GetImmediateLinkTarget(string linkPath, bool isDirectory, bool throwOnError, bool returnFullPath)
static unsafe SafeFileHandle OpenSafeFileHandle(string path, int flags)
static void Encrypt(string path)
static bool IsNameSurrogateReparsePoint(ref Interop.Kernel32.WIN32_FIND_DATA data)
static FileSystemInfo ResolveLinkTarget(string linkPath, bool returnFinalTarget, bool isDirectory)
static DateTimeOffset GetLastWriteTime(string fullPath)
static void MoveFile(string sourceFullPath, string destFullPath, bool overwrite)
static SafeFileHandle OpenHandle(string fullPath, bool asDirectory)
static void CopyFile(string sourceFullPath, string destFullPath, bool overwrite)
static void GetFindData(string fullPath, bool isDirectory, bool ignoreAccessDenied, ref Interop.Kernel32.WIN32_FIND_DATA findData)
static void SetCreationTime(string fullPath, DateTimeOffset time, bool asDirectory)
static bool FileExists(string fullPath)
static void Decrypt(string path)
static string[] GetLogicalDrives()
static bool DirectoryExists(string path, out int lastError)
static void RemoveDirectory(string fullPath, bool recursive)
static void RemoveDirectoryInternal(string fullPath, bool topLevel, bool allowDirectoryNotEmpty=false)
static int FillAttributeInfo(string path, ref Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data, bool returnErrorOnNotFound)
static void SetLastWriteTime(string fullPath, DateTimeOffset time, bool asDirectory)
static void RemoveDirectoryRecursive(string fullPath, ref Interop.Kernel32.WIN32_FIND_DATA findData, bool topLevel)
static DateTimeOffset GetCreationTime(string fullPath)
static int FillAttributeInfo(string path, ref global::Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data, bool returnErrorOnNotFound)
static void VerifyValidPath(string path, string argName)
static void SetAttributes(string fullPath, FileAttributes attributes)
static string GetLinkTarget(string linkPath, bool isDirectory)
static void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors)
static void CreateSymbolicLink(string path, string pathToTarget, bool isDirectory)
static void SetLastAccessTime(string fullPath, DateTimeOffset time, bool asDirectory)
static bool IsPathUnreachableError(int errorCode)
static void MoveDirectory(string sourceFullPath, string destFullPath)
static FileAttributes GetAttributes(string fullPath)
static unsafe void SetFileTime(string fullPath, bool asDirectory, long creationTime=-1L, long lastAccessTime=-1L, long lastWriteTime=-1L, long changeTime=-1L, uint fileAttributes=0u)
static bool EndsInDirectorySeparator(string path)
static int GetRootLength(ReadOnlySpan< char > path)
static string TrimEndingDirectorySeparator(string path)
static string GetLinkTargetFullPath(string path, string pathToTarget)
static bool IsDirectorySeparator(char c)
static string EnsureExtendedPrefix(string path)
static bool IsExtended(ReadOnlySpan< char > path)
static string Combine(string path1, string path2)
static string GetFullPath(string path)
static string TrimEndingDirectorySeparator(string path)
static string Join(ReadOnlySpan< char > path1, ReadOnlySpan< char > path2)
static ? string GetPathRoot(string? path)
static readonly char VolumeSeparatorChar
static ? string GetDirectoryName(string? path)
static int MakeHRFromErrorCode(int errorCode)
static Exception GetExceptionForLastWin32Error(string path="")
static Exception GetExceptionForWin32Error(int errorCode, string path="")
static int GetLastWin32Error()
static string Arg_FileIsDirectory_Name
static string Arg_InvalidFileAttrs
static string Argument_InvalidPathChars
static string Format(string resourceFormat, object p1)
static string UnauthorizedAccess_IODenied_Path
static string Arg_PathEmpty
static string Arg_PathIsVolume
static string PlatformNotSupported_FileEncryption
DateTimeOffset ToDateTimeOffset()
ushort SubstituteNameOffset
FILE_TIME ftLastAccessTime
FILE_TIME ftLastWriteTime
static readonly IntPtr Zero