Browse Source

v1.9.4, v3.2.9, v1.1.3

Former-commit-id: c038bd08676e26026efa8a6ea25e39ffdfd222e9
af/merge-core
James South 12 years ago
parent
commit
bd351e26dc
  1. 10
      build/Build.bat
  2. 8
      build/NuSpecs/ImageProcessor.Web.Config.nuspec
  3. 4
      build/NuSpecs/ImageProcessor.Web.nuspec
  4. 4
      build/content/ImageProcessor.Web.Config/web.config.transform
  5. 15
      src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj
  6. 3
      src/ImageProcessor.Web/NET4/ImageProcessor.Web_NET4.csproj
  7. 69
      src/ImageProcessor.Web/NET45/Caching/DiskCache.cs
  8. 56
      src/ImageProcessor.Web/NET45/Extensions/DirectoryInfoExtensions.cs
  9. 1
      src/ImageProcessor.Web/NET45/ImageProcessor.Web_NET45.csproj
  10. 4
      src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs
  11. 4
      src/ImageProcessor/Properties/AssemblyInfo.cs

10
build/Build.bat

@ -1,13 +1,13 @@
@ECHO OFF
SET version=1.9.3.0
SET webversion=3.2.8.0
SET webconfigversion=1.1.2.0
SET version=1.9.4.0
SET webversion=3.2.9.0
SET webconfigversion=1.1.3.0
ECHO Building ImageProcessor %version%, ImageProcess.Web %webversion% and ImageProcess.Web.Config %webconfigversion%
ECHO Installing the Microsoft.Bcl.Build package before anything else, otherwise you'd have to run build.cmd twice
SET nuGetFolder=%CD%\..\src\packages\
..\src\.nuget\NuGet.exe install ..\src\ImageProcessor.Web\NET45\packages.config -OutputDirectory %nuGetFolder%
..\src\.nuget\NuGet.exe install ..\src\ImageProcessor.Web\NET4\packages.config -OutputDirectory %nuGetFolder%
ECHO Removing _BuildOutput directory so everything is nice and clean
RD _BuildOutput /q /s
@ -19,7 +19,7 @@ ECHO Packing the NuGet release files
..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.nuspec -Version %version%
..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.Web.nuspec -Version %webversion%
..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.Web.Config.nuspec -Version %webconfigversion%
PAUSE
IF ERRORLEVEL 1 GOTO :showerror

8
build/NuSpecs/ImageProcessor.Web.Config.nuspec

@ -21,12 +21,12 @@ Feedback is always welcome</description>
<tags>Image Imaging ASP Performance Processing HttpModule Cache Resize Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated</tags>
<dependencies>
<group targetFramework=".NETFramework4.0">
<dependency id="ImageProcessor" version="1.9.3.0" />
<dependency id="ImageProcessor.Web" version="3.2.7.0" />
<dependency id="ImageProcessor" version="1.9.4.0" />
<dependency id="ImageProcessor.Web" version="3.2.9.0" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="1.9.3.0" />
<dependency id="ImageProcessor.Web" version="3.2.7.0" />
<dependency id="ImageProcessor" version="1.9.4.0" />
<dependency id="ImageProcessor.Web" version="3.2.9.0" />
</group>
</dependencies>
</metadata>

4
build/NuSpecs/ImageProcessor.Web.nuspec

@ -27,10 +27,10 @@ Feedback is always welcome</description>
<group targetFramework=".NETFramework4.0">
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl" version="1.1.9" />
<dependency id="ImageProcessor" version="1.9.3.0" />
<dependency id="ImageProcessor" version="1.9.4.0" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="1.9.3.0" />
<dependency id="ImageProcessor" version="1.9.4.0" />
</group>
</dependencies>
</metadata>

4
build/content/ImageProcessor.Web.Config/web.config.transform

@ -13,8 +13,4 @@
<cache configSource="config\imageprocessor\cache.config" />
<processing configSource="config\imageprocessor\processing.config" />
</imageProcessor>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

15
src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -8,6 +8,8 @@
<RootNamespace>ImageProcessor.UnitTests</RootNamespace>
<AssemblyName>ImageProcessor.UnitTests</AssemblyName>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -162,7 +164,12 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Images\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
</Project>

3
src/ImageProcessor.Web/NET4/ImageProcessor.Web_NET4.csproj

@ -87,6 +87,9 @@
<Compile Include="..\NET45\Config\ImageProcessingSection.cs" />
<Compile Include="..\NET45\Config\ImageProcessorConfig.cs" />
<Compile Include="..\NET45\Config\ImageSecuritySection.cs" />
<Compile Include="..\NET45\Extensions\DirectoryInfoExtensions.cs">
<Link>DirectoryInfoExtensions.cs</Link>
</Compile>
<Compile Include="..\NET45\Helpers\ImageHelpers.cs">
<Link>ImageHelpers.cs</Link>
</Compile>

69
src/ImageProcessor.Web/NET45/Caching/DiskCache.cs

@ -22,6 +22,7 @@ namespace ImageProcessor.Web.Caching
using System.Web.Hosting;
using ImageProcessor.Extensions;
using ImageProcessor.Web.Config;
using ImageProcessor.Web.Extensions;
using ImageProcessor.Web.Helpers;
#endregion
@ -224,58 +225,44 @@ namespace ImageProcessor.Web.Caching
/// </param>
private void TrimCachedFolders(string path)
{
// ReSharper disable once AssignNullToNotNullAttribute
DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(path));
DirectoryInfo parentDirectoryInfo = directoryInfo.Parent;
// ReSharper disable once PossibleNullReferenceException
foreach (DirectoryInfo enumerateDirectory in SafeEnumerateDirectories(parentDirectoryInfo))
string directory = Path.GetDirectoryName(path);
if (directory != null)
{
IEnumerable<FileInfo> files = enumerateDirectory.EnumerateFiles().OrderBy(f => f.CreationTimeUtc);
int count = files.Count();
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
DirectoryInfo parentDirectoryInfo = directoryInfo.Parent;
foreach (FileInfo fileInfo in files)
foreach (DirectoryInfo enumerateDirectory in parentDirectoryInfo.SafeEnumerateDirectories())
{
try
IEnumerable<FileInfo> files = enumerateDirectory.EnumerateFiles().OrderBy(f => f.CreationTimeUtc);
int count = files.Count();
foreach (FileInfo fileInfo in files)
{
// If the group count is equal to the max count minus 1 then we know we
// have reduced the number of items below the maximum allowed.
// We'll cleanup any orphaned expired files though.
if (!this.IsExpired(fileInfo.CreationTimeUtc) && count <= MaxFilesCount - 1)
try
{
break;
// If the group count is equal to the max count minus 1 then we know we
// have reduced the number of items below the maximum allowed.
// We'll cleanup any orphaned expired files though.
if (!this.IsExpired(fileInfo.CreationTimeUtc) && count <= MaxFilesCount - 1)
{
break;
}
// Remove from the cache and delete each CachedImage.
CacheIndexer.Remove(fileInfo.Name);
fileInfo.Delete();
count -= 1;
}
// ReSharper disable once EmptyGeneralCatchClause
catch
{
// Do nothing; skip to the next file.
}
// Remove from the cache and delete each CachedImage.
CacheIndexer.Remove(fileInfo.Name);
fileInfo.Delete();
count -= 1;
}
// ReSharper disable once EmptyGeneralCatchClause
catch
{
// Do nothing; skip to the next file.
}
}
}
}
public static IEnumerable<DirectoryInfo> SafeEnumerateDirectories(DirectoryInfo directoryInfo)
{
IEnumerable<DirectoryInfo> directories;
try
{
directories = directoryInfo.EnumerateDirectories();
}
catch
{
return Enumerable.Empty<DirectoryInfo>();
}
return directories;
}
/// <summary>
/// Gets the full transformed cached path for the image.
/// The images are stored in paths that are based upon the sha1 of their full request path

56
src/ImageProcessor.Web/NET45/Extensions/DirectoryInfoExtensions.cs

@ -0,0 +1,56 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DirectoryInfoExtensions.cs" company="James South">
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// <summary>
// Provides extension methods to the <see cref="System.IO.DirectoryInfo" /> type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.Web.Extensions
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
/// <summary>
/// Provides extension methods to the <see cref="System.IO.DirectoryInfo"/> type.
/// </summary>
public static class DirectoryInfoExtensions
{
/// <summary>
/// Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.
/// Will return an empty enumerable on exception. Quick and dirty but does what I need just now.
/// </summary>
/// <param name="directoryInfo">
/// The <see cref="System.IO.DirectoryInfo"/> that this method extends.
/// </param>
/// <param name="searchPattern">
/// The search string to match against the names of directories. This parameter can contain a combination of valid literal path
/// and wildcard (* and ?) characters (see Remarks), but doesn't support regular expressions. The default pattern is "*", which returns all files.
/// </param>
/// <param name="searchOption">
/// One of the enumeration values that specifies whether the search operation should include only
/// the current directory or all subdirectories. The default value is TopDirectoryOnly.
/// </param>
/// <returns>
/// An enumerable collection of directories that matches searchPattern and searchOption.
/// </returns>
public static IEnumerable<DirectoryInfo> SafeEnumerateDirectories(this DirectoryInfo directoryInfo, string searchPattern = "*", SearchOption searchOption = SearchOption.TopDirectoryOnly)
{
IEnumerable<DirectoryInfo> directories;
try
{
directories = directoryInfo.EnumerateDirectories(searchPattern, searchOption);
}
catch
{
return Enumerable.Empty<DirectoryInfo>();
}
return directories;
}
}
}

1
src/ImageProcessor.Web/NET45/ImageProcessor.Web_NET45.csproj

@ -53,6 +53,7 @@
<Compile Include="Config\ImageProcessingSection.cs" />
<Compile Include="Config\ImageProcessorConfig.cs" />
<Compile Include="Config\ImageSecuritySection.cs" />
<Compile Include="Extensions\DirectoryInfoExtensions.cs" />
<Compile Include="Helpers\ResourceHelpers.cs" />
<Compile Include="Helpers\ImageHelpers.cs" />
<Compile Include="Helpers\RemoteFile.cs" />

4
src/ImageProcessor.Web/NET45/Properties/AssemblyInfo.cs

@ -35,5 +35,5 @@ using ImageProcessor.Web.HttpModules;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.2.8.0")]
[assembly: AssemblyFileVersion("3.2.8.0")]
[assembly: AssemblyVersion("3.2.9.0")]
[assembly: AssemblyFileVersion("3.2.9.0")]

4
src/ImageProcessor/Properties/AssemblyInfo.cs

@ -32,6 +32,6 @@ using System.Security;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.9.3.0")]
[assembly: AssemblyFileVersion("1.9.3.0")]
[assembly: AssemblyVersion("1.9.4.0")]
[assembly: AssemblyFileVersion("1.9.4.0")]

Loading…
Cancel
Save