virtual bool Add()

in ProjectedFSLib.Managed.API/DirectoryEnumerationResults.h [204:253]


    virtual bool Add(
        System::String^ fileName,
        long long fileSize,
        bool isDirectory,
        System::IO::FileAttributes fileAttributes,
        System::DateTime creationTime,
        System::DateTime lastAccessTime,
        System::DateTime lastWriteTime,
        System::DateTime changeTime,
        System::String^ symlinkTargetOrNull) sealed
    {
        // This API is supported in Windows 10 version 2004 and above.
        if ((symlinkTargetOrNull != nullptr) &&
            (m_apiHelper->SupportedApi < ApiLevel::v2004))
        {
            throw gcnew NotImplementedException("PrjFillDirEntryBuffer2 is not supported in this version of Windows.");
        }

        ValidateFileName(fileName);

        pin_ptr<const WCHAR> pFileName = PtrToStringChars(fileName);
        PRJ_FILE_BASIC_INFO basicInfo = BuildFileBasicInfo(fileSize,
            isDirectory,
            fileAttributes,
            creationTime,
            lastAccessTime,
            lastWriteTime,
            changeTime);

        PRJ_EXTENDED_INFO extendedInfo = {};
        if (symlinkTargetOrNull != nullptr)
        {
            extendedInfo.InfoType = PRJ_EXT_INFO_TYPE_SYMLINK;
            pin_ptr<const WCHAR> targetPath = PtrToStringChars(symlinkTargetOrNull);
            extendedInfo.Symlink.TargetName = targetPath;
        }

        HRESULT hr;
        hr = m_apiHelper->_PrjFillDirEntryBuffer2(m_dirEntryBufferHandle,
                                                  pFileName,
                                                  &basicInfo,
                                                  (symlinkTargetOrNull != nullptr) ? &extendedInfo : nullptr);

        if FAILED(hr)
        {
            return false;
        }

        return true;
    }