protected FileSystemData(string path, WIN32_FIND_DATA raw) { _raw = raw; _path = path; _creationDateTimeUtc = DateTimeExt.FromFileTimeUtc(_raw.ftCreationTime); _lastAccessTimeUtc = DateTimeExt.FromFileTimeUtc(_raw.ftLastAccessTime); _lastWriteTimeUtc = DateTimeExt.FromFileTimeUtc(_raw.ftLastWriteTime); }
long CalculateFileSize(WIN32_FIND_DATA data) => CalculateFileSize(data.nFileSizeLow, data.nFileSizeHigh);
public FileData(string path, WIN32_FIND_DATA data) : base(path, data) { Size = CalculateFileSize(data); }
public DirectoryDataSnapshot(string path, WIN32_FIND_DATA data) : base(path, data) { }
internal static extern bool FindNextFile(IntPtr hFindFile, out WIN32_FIND_DATA lpFindFileData);
internal static extern IntPtr FindFirstFile(string lpFileName, out WIN32_FIND_DATA lpFindFileData);
/// <summary> /// Returns the correct Data Type for the item, either FileData or DirectoryData /// </summary> FileSystemData GenerateFileSystemReturnData(string path, WIN32_FIND_DATA data) { if (data.dwFileAttributes.IsDirectory()) { // This double checks we have a real directory if (data.cFileName != "." && data.cFileName != "..") { return new DirectoryData(path, data); } return null; } else { return new FileData(path, data); } }