internal static bool GetLastWriteDirectoryUtcTime(string fullPath, out DateTime fileModifiedTimeUtc) { fileModifiedTimeUtc = DateTime.MinValue; NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA lpFileInformation = new NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA(); bool flag = NativeMethodsShared.GetFileAttributesEx(fullPath, 0, ref lpFileInformation); if (flag) { if ((lpFileInformation.fileAttributes & 16) != 0) { long fileTime = (long) lpFileInformation.ftLastWriteTimeHigh << 32 | (long) lpFileInformation.ftLastWriteTimeLow; fileModifiedTimeUtc = DateTime.FromFileTimeUtc(fileTime); } else flag = false; } return flag; }
internal static bool FileOrDirectoryExistsNoThrow(string fullPath) { fullPath = FileUtilities.AttemptToShortenPath(fullPath); NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA lpFileInformation = new NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA(); return NativeMethodsShared.GetFileAttributesEx(fullPath, 0, ref lpFileInformation); }
internal static DateTime GetLastWriteFileUtcTime(string fullPath) { DateTime dateTime = DateTime.MinValue; NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA lpFileInformation = new NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA(); if (NativeMethodsShared.GetFileAttributesEx(fullPath, 0, ref lpFileInformation)) dateTime = DateTime.FromFileTimeUtc((long) lpFileInformation.ftLastWriteTimeHigh << 32 | (long) lpFileInformation.ftLastWriteTimeLow); return dateTime; }
internal static bool FileExistsNoThrow(string fullPath) { fullPath = FileUtilities.AttemptToShortenPath(fullPath); NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA lpFileInformation = new NativeMethodsShared.WIN32_FILE_ATTRIBUTE_DATA(); if (NativeMethodsShared.GetFileAttributesEx(fullPath, 0, ref lpFileInformation)) return (lpFileInformation.fileAttributes & 16) == 0; return false; }