//| <include file='doc\Directory.uex' path='docs/doc[@for="Directory.SetLastAccessTimeUtc"]/*' /> public static void SetLastAccessTimeUtc(String !path, DateTime lastAccessTimeUtc) { IntPtr handle = Directory.OpenHandle(path); bool r = Native.SetFileTime(handle, null, new long[] { lastAccessTimeUtc.ToFileTimeUtc() }, null); if (!r) { Native.CloseHandle(handle); __Error.WinIOError(1, path); } Native.CloseHandle(handle); }
/// <include file='doc\Directory.uex' path='docs/doc[@for="Directory.SetLastAccessTime"]/*' /> public unsafe static void SetLastAccessTime(String path, DateTime lastAccessTime) { { IntPtr handle = Directory.OpenHandle(path); Win32Native.FILE_TIME fileTime = new Win32Native.FILE_TIME(lastAccessTime.ToFileTime()); bool r = Win32Native.SetFileTime(handle, null, &fileTime, null); if (!r) { int errorCode = Marshal.GetLastWin32Error(); Win32Native.CloseHandle(handle); __Error.WinIOError(errorCode, path); } Win32Native.CloseHandle(handle); } }
/// <include file='doc\Directory.uex' path='docs/doc[@for="Directory.SetLastAccessTimeUtc"]/*' /> public static void SetLastAccessTimeUtc(String path, DateTime lastAccessTimeUtc) { if ((Environment.OSInfo & Environment.OSName.WinNT) == Environment.OSName.WinNT) { IntPtr handle = Directory.OpenHandle(path); bool r = Win32Native.SetFileTime(handle, null, new long[] { lastAccessTimeUtc.ToFileTimeUtc() }, null); if (!r) { int errorCode = Marshal.GetLastWin32Error(); Win32Native.CloseHandle(handle); __Error.WinIOError(errorCode, path); } Win32Native.CloseHandle(handle); } }