diff --git a/src/ImageProcessor.Tests/ImageProcessor.Tests.csproj b/src/ImageProcessor.Tests/ImageProcessor.Tests.csproj index d520934a6..3d3e5c241 100644 --- a/src/ImageProcessor.Tests/ImageProcessor.Tests.csproj +++ b/src/ImageProcessor.Tests/ImageProcessor.Tests.csproj @@ -48,7 +48,7 @@ TRACE true pdbonly - x86 + AnyCPU prompt MinimumRecommendedRules.ruleset diff --git a/src/ImageProcessor.Web/NET45/Caching/CacheIndexer.cs b/src/ImageProcessor.Web/NET45/Caching/CacheIndexer.cs index 40c089ffe..6e975dbd3 100644 --- a/src/ImageProcessor.Web/NET45/Caching/CacheIndexer.cs +++ b/src/ImageProcessor.Web/NET45/Caching/CacheIndexer.cs @@ -114,6 +114,7 @@ namespace ImageProcessor.Web.Caching { Key = Path.GetFileNameWithoutExtension(cachePath), Path = cachePath, + CreationTimeUtc = fileInfo.CreationTimeUtc, LastWriteTimeUtc = fileInfo.LastWriteTimeUtc }; } diff --git a/src/ImageProcessor.Web/NET45/Caching/CachedImage.cs b/src/ImageProcessor.Web/NET45/Caching/CachedImage.cs index 14e8a3811..592d84eb4 100644 --- a/src/ImageProcessor.Web/NET45/Caching/CachedImage.cs +++ b/src/ImageProcessor.Web/NET45/Caching/CachedImage.cs @@ -29,6 +29,11 @@ namespace ImageProcessor.Web.Caching /// public string Path { get; set; } + /// + /// Gets or sets the creation time of the cached image. + /// + public DateTime CreationTimeUtc { get; set; } + /// /// Gets or sets the last write time of the cached image. /// diff --git a/src/ImageProcessor.Web/NET45/Caching/DiskCache.cs b/src/ImageProcessor.Web/NET45/Caching/DiskCache.cs index bf516756b..9bb891783 100644 --- a/src/ImageProcessor.Web/NET45/Caching/DiskCache.cs +++ b/src/ImageProcessor.Web/NET45/Caching/DiskCache.cs @@ -142,17 +142,18 @@ namespace ImageProcessor.Web.Caching /// /// Adds an image to the cache. /// - /// - /// The last write time. + /// + /// The creation and last write times. /// - internal void AddImageToCache(DateTime lastWriteTimeUtc) + internal void AddImageToCache(Tuple creationAndLastWriteDateTimes) { string key = Path.GetFileNameWithoutExtension(this.CachedPath); CachedImage cachedImage = new CachedImage { Key = key, Path = this.CachedPath, - LastWriteTimeUtc = lastWriteTimeUtc + CreationTimeUtc = creationAndLastWriteDateTimes.Item1, + LastWriteTimeUtc = creationAndLastWriteDateTimes.Item2 }; CacheIndexer.Add(cachedImage); @@ -178,7 +179,7 @@ namespace ImageProcessor.Web.Caching { // Can't check the last write time so check to see if the cached image is set to expire // or if the max age is different. - if (cachedImage.LastWriteTimeUtc.AddDays(MaxFileCachedDuration) < DateTime.UtcNow.AddDays(-MaxFileCachedDuration)) + if (cachedImage.CreationTimeUtc.AddDays(MaxFileCachedDuration) < DateTime.UtcNow.AddDays(-MaxFileCachedDuration)) { CacheIndexer.Remove(path); isUpdated = true; @@ -207,7 +208,7 @@ namespace ImageProcessor.Web.Caching // Check to see if the last write time is different of whether the // cached image is set to expire or if the max age is different. if (!this.RoughDateTimeCompare(imageFileInfo.LastWriteTimeUtc, cachedImage.LastWriteTimeUtc) - || cachedImage.LastWriteTimeUtc.AddDays(MaxFileCachedDuration) < DateTime.UtcNow.AddDays(-MaxFileCachedDuration)) + || cachedImage.CreationTimeUtc.AddDays(MaxFileCachedDuration) < DateTime.UtcNow.AddDays(-MaxFileCachedDuration)) { CacheIndexer.Remove(path); isUpdated = true; @@ -250,7 +251,7 @@ namespace ImageProcessor.Web.Caching /// /// The set to the last write time of the file. /// - internal async Task SetCachedLastWriteTimeAsync() + internal async Task> SetCachedLastWriteTimeAsync() { // Create Action delegate for SetCachedLastWriteTime. return await TaskHelpers.Run(() => this.SetCachedLastWriteTime()); @@ -278,15 +279,18 @@ namespace ImageProcessor.Web.Caching /// /// The of the original and cached file. /// - private DateTime SetCachedLastWriteTime() + private Tuple SetCachedLastWriteTime() { FileInfo cachedFileInfo = new FileInfo(this.CachedPath); + DateTime creationTime = DateTime.MinValue.ToUniversalTime(); DateTime lastWriteTime = DateTime.MinValue.ToUniversalTime(); + if (this.isRemote) { if (cachedFileInfo.Exists) { + creationTime = cachedFileInfo.CreationTimeUtc; lastWriteTime = cachedFileInfo.LastWriteTimeUtc; } } @@ -297,13 +301,14 @@ namespace ImageProcessor.Web.Caching if (imageFileInfo.Exists && cachedFileInfo.Exists) { DateTime dateTime = imageFileInfo.LastWriteTimeUtc; + creationTime = cachedFileInfo.CreationTimeUtc; cachedFileInfo.LastWriteTimeUtc = dateTime; lastWriteTime = dateTime; } } - return lastWriteTime; + return new Tuple(creationTime, lastWriteTime); } /// @@ -316,7 +321,7 @@ namespace ImageProcessor.Web.Caching { // ReSharper disable once AssignNullToNotNullAttribute DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(path)); - IEnumerable files = directoryInfo.EnumerateFiles().OrderBy(f => f.LastWriteTimeUtc); + IEnumerable files = directoryInfo.EnumerateFiles().OrderBy(f => f.CreationTimeUtc); int count = files.Count(); foreach (FileInfo fileInfo in files) diff --git a/src/ImageProcessor.Web/NET45/HttpModules/ImageProcessingModule.cs b/src/ImageProcessor.Web/NET45/HttpModules/ImageProcessingModule.cs index e4c2bcd1b..1a7296ed1 100644 --- a/src/ImageProcessor.Web/NET45/HttpModules/ImageProcessingModule.cs +++ b/src/ImageProcessor.Web/NET45/HttpModules/ImageProcessingModule.cs @@ -300,10 +300,10 @@ namespace ImageProcessor.Web.HttpModules .AutoProcess().Save(cachedPath); // Ensure that the LastWriteTime property of the source and cached file match. - DateTime dateTime = await cache.SetCachedLastWriteTimeAsync(); + Tuple creationAndLastWriteDateTimes = await cache.SetCachedLastWriteTimeAsync(); // Add to the cache. - cache.AddImageToCache(dateTime); + cache.AddImageToCache(creationAndLastWriteDateTimes); // Trim the cache. await cache.TrimCachedFolderAsync(cachedPath); @@ -315,12 +315,12 @@ namespace ImageProcessor.Web.HttpModules else { imageFactory.Load(fullPath).AutoProcess().Save(cachedPath); - + // Ensure that the LastWriteTime property of the source and cached file match. - DateTime dateTime = await cache.SetCachedLastWriteTimeAsync(); + Tuple creationAndLastWriteDateTimes = await cache.SetCachedLastWriteTimeAsync(); // Add to the cache. - cache.AddImageToCache(dateTime); + cache.AddImageToCache(creationAndLastWriteDateTimes); // Trim the cache. await cache.TrimCachedFolderAsync(cachedPath); diff --git a/src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs b/src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs index 89b552680..7d9768332 100644 --- a/src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs +++ b/src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.0.1")] -[assembly: AssemblyFileVersion("3.0.0.1")] +[assembly: AssemblyVersion("3.0.0.2")] +[assembly: AssemblyFileVersion("3.0.0.2")] diff --git a/src/Nuget/ImageProcessor.1.7.1.1.nupkg b/src/Nuget/ImageProcessor.1.7.1.1.nupkg deleted file mode 100644 index 6b8c4ea7c..000000000 Binary files a/src/Nuget/ImageProcessor.1.7.1.1.nupkg and /dev/null differ diff --git a/src/Nuget/ImageProcessor.Web.2.3.0.6.nupkg.REMOVED.git-id b/src/Nuget/ImageProcessor.Web.2.3.0.6.nupkg.REMOVED.git-id deleted file mode 100644 index a7d54c05f..000000000 --- a/src/Nuget/ImageProcessor.Web.2.3.0.6.nupkg.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7f1cb06ddbb5a91892188c8a18109d8db0f76115 \ No newline at end of file diff --git a/src/Nuget/ImageProcessor.Web.3.0.0.0.nupkg b/src/Nuget/ImageProcessor.Web.3.0.0.0.nupkg deleted file mode 100644 index 6821b7676..000000000 Binary files a/src/Nuget/ImageProcessor.Web.3.0.0.0.nupkg and /dev/null differ diff --git a/src/Nuget/ImageProcessor.Web.3.0.0.2.nupkg b/src/Nuget/ImageProcessor.Web.3.0.0.2.nupkg new file mode 100644 index 000000000..e18742e8c Binary files /dev/null and b/src/Nuget/ImageProcessor.Web.3.0.0.2.nupkg differ diff --git a/src/TestWebsites/NET45/Test_Website_NET45/Web.config b/src/TestWebsites/NET45/Test_Website_NET45/Web.config index a85d42b44..70a09ab84 100644 --- a/src/TestWebsites/NET45/Test_Website_NET45/Web.config +++ b/src/TestWebsites/NET45/Test_Website_NET45/Web.config @@ -19,11 +19,11 @@ - + - + diff --git a/src/TestWebsites/NET45/Test_Website_NET45/config/imageprocessor/processing.config b/src/TestWebsites/NET45/Test_Website_NET45/config/imageprocessor/processing.config index 21e2d0b46..844c56d40 100644 --- a/src/TestWebsites/NET45/Test_Website_NET45/config/imageprocessor/processing.config +++ b/src/TestWebsites/NET45/Test_Website_NET45/config/imageprocessor/processing.config @@ -1,17 +1,17 @@  - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +