public async Task ImportChannelsAndContentsAsync(int parentId, string siteContentDirectoryPath, bool isOverride, string guid) { var filePathList = GetSiteContentFilePathList(siteContentDirectoryPath); var siteIe = new SiteIe(_pathManager, _databaseManager, _caching, _site, siteContentDirectoryPath); var parentOrderString = "none"; //int parentID = 0; foreach (var filePath in filePathList) { var firstIndex = filePath.LastIndexOf(PathUtils.SeparatorChar) + 1; var lastIndex = filePath.LastIndexOf(".", StringComparison.Ordinal); var orderString = filePath.Substring(firstIndex, lastIndex - firstIndex); if (StringUtils.StartsWithIgnoreCase(orderString, parentOrderString)) { parentId = await siteIe.ImportChannelsAndContentsAsync(filePath, true, isOverride, parentId, _adminId, guid); parentOrderString = orderString; } else { await siteIe.ImportChannelsAndContentsAsync(filePath, true, isOverride, parentId, _adminId, guid); } } }
private async Task ImportChannelsAndContentsFromZipAsync(int parentId, string siteContentDirectoryPath, bool isOverride, string guid) { var filePathList = GetSiteContentFilePathList(siteContentDirectoryPath); var siteIe = new SiteIe(_pathManager, _databaseManager, _caching, _site, siteContentDirectoryPath); Hashtable levelHashtable = null; foreach (var filePath in filePathList) { var firstIndex = filePath.LastIndexOf(PathUtils.SeparatorChar) + 1; var lastIndex = filePath.LastIndexOf(".", StringComparison.Ordinal); var orderString = filePath.Substring(firstIndex, lastIndex - firstIndex); var level = StringUtils.GetCount("_", orderString); if (levelHashtable == null) { levelHashtable = new Hashtable { [level] = parentId }; } var insertChannelId = await siteIe.ImportChannelsAndContentsAsync(filePath, true, isOverride, (int)levelHashtable[level], _adminId, guid); levelHashtable[level + 1] = insertChannelId; } }
public async Task ImportSiteContentAsync(string siteContentDirectoryPath, string filePath, bool isImportContents, string guid) { var siteIe = new SiteIe(_pathManager, _databaseManager, _caching, _site, siteContentDirectoryPath); await siteIe.ImportChannelsAndContentsAsync(filePath, isImportContents, false, 0, _adminId, guid); }