Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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;
 }