public async Task <bool> ExportContentsAsync(string filePath, List <Content> contentInfoList) { var siteContentDirectoryPath = PathUtils.Combine(DirectoryUtils.GetDirectoryPath(filePath), PathUtils.GetFileNameWithoutExtension(filePath)); FileUtils.DeleteFileIfExists(filePath); DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath); DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath); var contentIe = new ContentIe(_pathManager, _databaseManager, _caching, _site, siteContentDirectoryPath); var isExport = await contentIe.ExportContentsAsync(_site, contentInfoList); if (isExport) { _pathManager.CreateZip(filePath, siteContentDirectoryPath); DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath); } return(isExport); }
public async Task <bool> ExportContentsAsync(string filePath, int channelId, List <int> contentIdArrayList, bool isPeriods, string dateFrom, string dateTo, bool?checkedState) { var siteContentDirectoryPath = PathUtils.Combine(DirectoryUtils.GetDirectoryPath(filePath), PathUtils.GetFileNameWithoutExtension(filePath)); FileUtils.DeleteFileIfExists(filePath); DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath); DirectoryUtils.CreateDirectoryIfNotExists(siteContentDirectoryPath); var contentIe = new ContentIe(_pathManager, _databaseManager, _caching, _site, siteContentDirectoryPath); var isExport = await contentIe.ExportContentsAsync(_site, channelId, contentIdArrayList, isPeriods, dateFrom, dateTo, checkedState); if (isExport) { _pathManager.CreateZip(filePath, siteContentDirectoryPath); DirectoryUtils.DeleteDirectoryIfExists(siteContentDirectoryPath); } return(isExport); }