Пример #1
0
        /// <summary>
        /// Creates WIN32_FIND_DATA_ANSI structure and fills it with informations
        /// from FileSystemInfo instance.
        /// </summary>
        internal static WinApi.WIN32_FIND_DATA_ANSI FromFileInfo(FileSystemInfo fileSystemInfo)
        {
            var result = new WinApi.WIN32_FIND_DATA_ANSI();

            result.cFileName = fileSystemInfo.Name;
            var ct = new DateTime(2017, 2, 10, 11, 11, 11, DateTimeKind.Local).ToFileTime();

            result.ftLastWriteTime = GetFileTime(fileSystemInfo.LastWriteTime);
            if (fileSystemInfo is FileInfo fileInfo)
            {
                // File
                result.nFileSizeHigh    = (uint)(fileInfo.Length >> 32);
                result.nFileSizeLow     = (uint)(fileInfo.Length & 0xFFFFFFFFL);
                result.dwFileAttributes = (uint)fileInfo.Attributes;
            }
            else
            {
                // Directory
                result.dwFileAttributes |= 16;
            }
            return(result);
        }
 public static bool FsFindNext(
     IntPtr Hdl,
     ref WinApi.WIN32_FIND_DATA_ANSI FindData)
 {
     return(WfxManagedWrapper.Singleton.FindNext(Hdl, ref FindData));
 }
 public static IntPtr FsFindFirst(
     [MarshalAs(UnmanagedType.LPStr)] string Path,
     ref WinApi.WIN32_FIND_DATA_ANSI FindData)
 {
     return(WfxManagedWrapper.Singleton.FindFirst(Path, ref FindData));
 }