public FileSystemInfo ToFileSystemInfo() { FileSystemInfo info; if (this.IsDirectory) { info = new DirectoryInfo(this.FFullName); } else { info = new FileInfo(this.FFullName); } Microsoft.Win32.WIN32_FILE_ATTRIBUTE_DATA fileAttributeData = new Microsoft.Win32.WIN32_FILE_ATTRIBUTE_DATA { dwFileAttributes = this.FFileAttributes, ftCreationTime = IoHelper.DateTimeToFileTime(this.FCreationTime), ftLastAccessTime = IoHelper.DateTimeToFileTime(this.FLastAccessTime), ftLastWriteTime = IoHelper.DateTimeToFileTime(this.FLastWriteTime), nFileSizeHigh = (uint) (this.FSize >> 0x20), nFileSizeLow = (uint) (((ulong) this.FSize) & 0xffffffffL) }; IoHelper.InitializeFileSystemInfo(info, ref fileAttributeData); return info; }
internal static extern bool GetFileAttributesEx(String name, int fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation);
internal static void InitializeFileSystemInfo(FileSystemInfo info, Microsoft.Win32.WIN32_FIND_DATA findData) { Microsoft.Win32.WIN32_FILE_ATTRIBUTE_DATA fileAttributeData = new Microsoft.Win32.WIN32_FILE_ATTRIBUTE_DATA { dwFileAttributes = findData.dwFileAttributes, ftCreationTime = findData.ftCreationTime, ftLastAccessTime = findData.ftLastAccessTime, ftLastWriteTime = findData.ftLastWriteTime, nFileSizeHigh = findData.nFileSizeHigh, nFileSizeLow = findData.nFileSizeLow }; InitializeFileSystemInfo(info, ref fileAttributeData); }
internal static extern bool GetFileAttributesEx(string name, int fileInfoLevel, out WIN32_FILE_ATTRIBUTE_DATA data);
static extern bool GetFileAttributesEx(string lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, out WIN32_FILE_ATTRIBUTE_DATA fileData);