internal IntPtr FindFirst(string path, ref WIN32_FIND_DATA_ANSI findData) { try { // Find directory in virtual filesystem representing %path. var entryForPath = VirtualFilesystemUtils.TryFindFilesystemEntry(path, m_Plugin.GetRootDirectoryEntry()); if (entryForPath is DirectoryEntryBase directoryEntryForPath) { var enumeration = directoryEntryForPath.EnumerateChildFilesystemEntries(); if (enumeration != null) { var enumerator = enumeration.GetEnumerator(); if (enumerator != null && enumerator.MoveNext()) { findData = enumerator.Current.ToFindDataAnsi(); return(m_EnumerationsManager.Add(enumerator)); } } // Directory is empty Kernel32Functions.SetLastError(ErrorCodes.ERROR_NO_MORE_FILES); return(Handles.INVALID_HANDLE_VALUE); } // Path does not exists or is not directory Kernel32Functions.SetLastError(ErrorCodes.ERROR_PATH_NOT_FOUND); return(Handles.INVALID_HANDLE_VALUE); } catch { Kernel32Functions.SetLastError(ErrorCodes.ERROR_INVALID_FUNCTION); return(Handles.INVALID_HANDLE_VALUE); } }
/// <summary> /// When overridden in derived class, creates WIN32_FIND_DATA_ANSI /// structure filled with informations from this instance. /// </summary> internal WIN32_FIND_DATA_ANSI ToFindDataAnsi() { var result = new WIN32_FIND_DATA_ANSI(); result.cFileName = Name; FillFindDataAnsi(ref result); return(result); }
internal bool FindNext(IntPtr enumerationId, ref WIN32_FIND_DATA_ANSI findData) { try { var enumerator = m_EnumerationsManager.Get(enumerationId); if (enumerator.MoveNext()) { findData = enumerator.Current.ToFindDataAnsi(); return(true); } else { return(false); } } catch { return(false); } }
internal override void FillFindDataAnsi(ref WIN32_FIND_DATA_ANSI findData) { findData.dwFileAttributes |= 16;//Directory attribute //ToDo: attributes, dates, etc. }
internal override void FillFindDataAnsi(ref WIN32_FIND_DATA_ANSI findData) { //ToDo: Fill file size, attributes, dates, etc. }
internal abstract void FillFindDataAnsi(ref WIN32_FIND_DATA_ANSI findData);