コード例 #1
0
 internal static DateTime GetLastWriteTimeUtc(string fullPath)
 {
     DateTime minValue = DateTime.MinValue;
     WIN32_FILE_ATTRIBUTE_DATA lpFileInformation = new WIN32_FILE_ATTRIBUTE_DATA();
     if (GetFileAttributesEx(fullPath, 0, ref lpFileInformation))
     {
         long fileTime = (lpFileInformation.ftLastWriteTimeHigh << 0x20) | lpFileInformation.ftLastWriteTimeLow;
         minValue = DateTime.FromFileTimeUtc(fileTime);
     }
     return minValue;
 }
コード例 #2
0
        internal static DateTime GetLastWriteTimeUtc(string fullPath)
        {
            DateTime minValue = DateTime.MinValue;
            WIN32_FILE_ATTRIBUTE_DATA lpFileInformation = new WIN32_FILE_ATTRIBUTE_DATA();

            if (GetFileAttributesEx(fullPath, 0, ref lpFileInformation))
            {
                long fileTime = (lpFileInformation.ftLastWriteTimeHigh << 0x20) | lpFileInformation.ftLastWriteTimeLow;
                minValue = DateTime.FromFileTimeUtc(fileTime);
            }
            return(minValue);
        }
コード例 #3
0
ファイル: NativeMethods.cs プロジェクト: cameron314/msbuild
        /// <summary>
        /// Get the last write time in utc of the fullpath to the file. 
        /// If the file does not exist, then DateTime.MinValue is returned
        /// </summary>
        /// <param name="fullPath">Full path to the file in the filesystem</param>
        /// <returns></returns>
        internal static DateTime GetLastWriteTimeUtc(string fullPath)
        {
            DateTime fileModifiedTime = DateTime.MinValue;
            WIN32_FILE_ATTRIBUTE_DATA data = new WIN32_FILE_ATTRIBUTE_DATA();
            bool success = false;

            success = NativeMethods.GetFileAttributesEx(fullPath, 0, ref data);
            if (success)
            {
                long dt = ((long)(data.ftLastWriteTimeHigh) << 32) | ((long)data.ftLastWriteTimeLow);
                fileModifiedTime = DateTime.FromFileTimeUtc(dt);
            }

            return fileModifiedTime;
        }
コード例 #4
0
        /// <summary>
        /// Get the last write time in utc of the fullpath to the file.
        /// If the file does not exist, then DateTime.MinValue is returned
        /// </summary>
        /// <param name="fullPath">Full path to the file in the filesystem</param>
        /// <returns></returns>
        internal static DateTime GetLastWriteTimeUtc(string fullPath)
        {
            DateTime fileModifiedTime      = DateTime.MinValue;
            WIN32_FILE_ATTRIBUTE_DATA data = new WIN32_FILE_ATTRIBUTE_DATA();
            bool success = false;

            success = NativeMethods.GetFileAttributesEx(fullPath, 0, ref data);
            if (success)
            {
                long dt = ((long)(data.ftLastWriteTimeHigh) << 32) | ((long)data.ftLastWriteTimeLow);
                fileModifiedTime = DateTime.FromFileTimeUtc(dt);
            }

            return(fileModifiedTime);
        }
コード例 #5
0
 internal static extern bool GetFileAttributesEx(string name, int fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation);
コード例 #6
0
 internal static extern bool GetFileAttributesEx(string name, int fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation);