/// <summary>The restore sprited images from cache.</summary> /// <param name="mapXmlFile">The map xml file.</param> /// <param name="cacheSection">The cache section.</param> /// <param name="results">The results.</param> /// <param name="destinationDirectory">The destination Directory.</param> /// <param name="imageAssembleScanDestinationFile">The image Assemble Scan Destination File.</param> /// <returns>The <see cref="bool"/>.</returns> private static ImageLog RestoreSpritedImagesFromCache(string mapXmlFile, ICacheSection cacheSection, BlockingCollection <ContentItem> results, string destinationDirectory, string imageAssembleScanDestinationFile) { // restore log file, is required by next step in applying sprites to the css. var spriteLogFileContentItem = cacheSection.GetCachedContentItems(CacheFileCategories.SpriteLogFile).FirstOrDefault(); if (spriteLogFileContentItem == null) { return(null); } if (!string.IsNullOrWhiteSpace(imageAssembleScanDestinationFile)) { var spriteLogFileXmlContentItem = cacheSection.GetCachedContentItems(CacheFileCategories.SpriteLogFileXml).FirstOrDefault(); if (spriteLogFileXmlContentItem != null) { spriteLogFileXmlContentItem.WriteTo(mapXmlFile); } } var imageLog = spriteLogFileContentItem.Content.FromJson <ImageLog>(true); // Restore images var spritedImageContentItems = cacheSection.GetCachedContentItems(CacheFileCategories.HashedSpriteImage); spritedImageContentItems.ForEach(sici => sici.WriteToContentPath(destinationDirectory)); results.AddRange(spritedImageContentItems); return(imageLog); }
/// <summary>The restore bundle from cache.</summary> /// <param name="cacheSection">The cache section.</param> /// <returns>The <see cref="bool"/>.</returns> private bool RestoreBundleFromCache(ICacheSection cacheSection) { var endResults = cacheSection.GetCachedContentItems(CacheFileCategories.AssemblerResult, true); endResults.ForEach(er => er.WriteToContentPath(this.context.Configuration.DestinationDirectory)); return(true); }