internal bool ShouldSkipExtraLarge(string publishProfileName) { var skipExtraLarge = _publishPreflight?.GetPublishProfileName(publishProfileName)? .All(p => p.SourceMaxWidth <= 1999); return(skipExtraLarge == true); }
/// <summary> /// Render output of Publish action /// </summary> /// <param name="fileIndexItemsList">which items need to be published</param> /// <param name="base64ImageArray">list of base64 hashes for html pages</param> /// <param name="publishProfileName">name of profile</param> /// <param name="itemName">output publish item name</param> /// <param name="outputParentFullFilePathFolder">path on host disk where to publish to</param> /// <param name="moveSourceFiles">include source files (false by default)</param> /// <returns></returns> public async Task <Dictionary <string, bool> > Render(List <FileIndexItem> fileIndexItemsList, string[] base64ImageArray, string publishProfileName, string itemName, string outputParentFullFilePathFolder, bool moveSourceFiles = false) { if (!_appSettings.PublishProfiles.Any()) { _console.WriteLine("There are no config items"); return(null); } if (!_appSettings.PublishProfiles.ContainsKey(publishProfileName)) { _console.WriteLine("Key not found"); return(null); } if (!_hostFileSystemStorage.ExistFolder(outputParentFullFilePathFolder)) { _hostFileSystemStorage.CreateDirectory(outputParentFullFilePathFolder); } if (base64ImageArray == null) { base64ImageArray = new string[fileIndexItemsList.Count]; } // Order alphabetically // Ignore Items with Errors fileIndexItemsList = fileIndexItemsList.OrderBy(p => p.FileName) .Where(p => p.Status == FileIndexItem.ExifStatus.Ok).ToList(); var copyResult = new Dictionary <string, bool>(); var profiles = _publishPreflight.GetPublishProfileName(publishProfileName); foreach (var currentProfile in profiles) { switch (currentProfile.ContentType) { case TemplateContentType.Html: copyResult.AddRangeOverride(await GenerateWebHtml(profiles, currentProfile, itemName, base64ImageArray, fileIndexItemsList, outputParentFullFilePathFolder)); break; case TemplateContentType.Jpeg: copyResult.AddRangeOverride(await GenerateJpeg(currentProfile, fileIndexItemsList, outputParentFullFilePathFolder)); break; case TemplateContentType.MoveSourceFiles: copyResult.AddRangeOverride(await GenerateMoveSourceFiles(currentProfile, fileIndexItemsList, outputParentFullFilePathFolder, moveSourceFiles)); break; case TemplateContentType.PublishContent: // Copy all items in the subFolder content for example JavaScripts copyResult.AddRangeOverride(_copyPublishedContent.CopyContent(currentProfile, outputParentFullFilePathFolder)); break; case TemplateContentType.PublishManifest: copyResult.Add( _overlayImage.FilePathOverlayImage("_settings.json", currentProfile) , true); break; case TemplateContentType.OnlyFirstJpeg: if (!fileIndexItemsList.Any()) { break; } var firstInList = new List <FileIndexItem> { fileIndexItemsList.FirstOrDefault() }; copyResult.AddRangeOverride(await GenerateJpeg(currentProfile, firstInList, outputParentFullFilePathFolder)); break; } } return(copyResult); }