std::wstring FileTreeFactory::GetFilePath(const FileNode &fileAttributes) { std::wstring strPath; std::wstring strFileName; fileAttributes.GetValue(FileAttributeType_strPath, strPath); fileAttributes.GetValue(FileAttributeType_strName, strFileName); return strPath + L"\\" + strFileName; }
bool FileTreeFactory::CreateNote(const std::wstring strFileName, FileNode &file) { if (CreateFile(strFileName, NOTE_TYPE, file)) { std::wstring strPath; file.GetValue(FileAttributeType_strPath, strPath); return OnCreateFolder(strPath + L"\\" + strFileName); } return false; }
bool FileTreeFactory::CreateFile(const FileNode &parentFile, const std::wstring strName, const FileType eFileType, FileNode &childFile) { if (CreateFile(strName, eFileType, childFile)) { std::wstring strPath; std::wstring strFolderName; parentFile.GetValue(FileAttributeType_strName, strFolderName); parentFile.GetValue(FileAttributeType_strPath, strPath); std::wstring strNewFilePath = strPath + L"\\" + strFolderName; childFile.SetValue(FileAttributeType_strPath, strNewFilePath); std::wstring strFileName; childFile.GetValue(FileAttributeType_strName, strFileName); std::wstring strNewFileName = strNewFilePath + L"\\" + strFileName; if (eFileType == FOLDER_TYPE) return OnCreateFolder(strNewFileName); else return OnCreateFile(strNewFileName); } return false; }