public static DateTime GetLastWriteTime(string path) { var info = new WinApi.FILE_ATTRIBUTE_DATA(); if (!WinApi.GetFileAttributesExW(path, 0, ref info)) { throw new IOException("Unable to get file into", Marshal.GetLastWin32Error()); } long result = (long)((ulong)info.ftLastWriteTimeHigh << 32 | (ulong)info.ftLastWriteTimeLow); return(DateTime.FromFileTimeUtc(result).ToLocalTime()); }
public static DateTime GetLastWriteTime(string path) { var info = new WinApi.FILE_ATTRIBUTE_DATA(); if (!WinApi.GetFileAttributesEx(path, 0, ref info)) throw new IOException("Unable to get file into", Marshal.GetLastWin32Error()); long result = (long)((ulong)info.ftLastWriteTimeHigh << 32 | (ulong)info.ftLastWriteTimeLow); return DateTime.FromFileTimeUtc(result).ToLocalTime(); }