Skip to content

Commit 8dd79ae

Browse files
committed
2 parents 19eb749 + f155a50 commit 8dd79ae

35 files changed

+2349
-12
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,18 @@
66
Imageflow.NET is a .NET API for Imageflow, the image handling library for web servers. Imageflow focuses on security, quality, and performance - in that order.
77

88

9+
```
10+
PM> Install-Package Imageflow.Net
11+
PM> Install-Package Imageflow.NativeRuntime.win-x86
12+
PM> Install-Package Imageflow.NativeRuntime.win-x86_64-sandybridge
13+
PM> Install-Package Imageflow.NativeRuntime.osx_10_11-x86_64
14+
PM> Install-Package Imageflow.NativeRuntime.ubuntu_14_04-x86_64
15+
```
16+
17+
Note: You must install the [appropriate NativeRuntime(s)](https://www.nuget.org/packages?q=Imageflow.NativeRuntime) in the project you are deploying - they have to copy imageflow.dll to the output folder.
18+
19+
[NativeRuntimes](https://www.nuget.org/packages?q=Imageflow.NativeRuntime) that are suffixed with -sandybridge (2011, AVX support) or -haswell (2013, AVX2 support) require a CPU of that generation or later.
20+
21+
922
* [Project source and issue site](https://github.com/imazen/imageflow-dotnet)
1023
* [Stack Overflow tag](http://stackoverflow.com/questions/tagged/imageflow.net) - for specific "How do I do X?" questions

appveyor.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ install:
3737
- SET "CI_STRING=name:AppVeyor job_id:%APPVEYOR_JOB_ID% build_id:%APPVEYOR_BUILD_ID% build_number:%APPVEYOR_BUILD_NUMBER% build_version:%APPVEYOR_BUILD_VERSION% account_name:%APPVEYOR_ACCOUNT_NAME% project_slug:%APPVEYOR_PROJECT_SLUG% tag_name:%APPVEYOR_REPO_TAG_NAME% pull_request_number:%APPVEYOR_PULL_REQUEST_NUMBER% branch:%APPVEYOR_REPO_BRANCH%"
3838
- SET "CI_TAG=%APPVEYOR_REPO_TAG_NAME%"
3939
- SET "CI_REPO=%APPVEYOR_REPO_NAME%"
40+
- SET "CI_PROJECT=%APPVEYOR_PROJECT_NAME%"
4041
- SET "CI_RELATED_BRANCH=%APPVEYOR_REPO_BRANCH%"
4142
- SET "CI_PULL_REQUEST_INFO=%APPVEYOR_PULL_REQUEST_NUMBER%"
4243
- SET "GIT_OPTIONAL_BRANCH="
@@ -53,8 +54,8 @@ install:
5354
- SET "PLATFORM_SUFFIX=%OS_SPECIFIC_SUFFIX%-%PLATFORM%"
5455
- if "%PLATFORM%"=="Any CPU" SET "PLATFORM_SUFFIX=%OS_SPECIFIC_SUFFIX%"
5556
- if "%PLATFORM%"=="" SET "PLATFORM_SUFFIX=%OS_SPECIFIC_SUFFIX%"
56-
- if "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_REPO%-build-%PADDED_BUILD_NUMBER%-%ARTIFACT_SERIES_NAME%-%INFORMATIONAL_VERSION%%PLATFORM_SUFFIX%"
57-
- if NOT "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_REPO%-%CI_TAG%-%SHORT_COMMIT%%PLATFORM_SUFFIX%"
57+
- if "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_PROJECT%-build-%PADDED_BUILD_NUMBER%-%ARTIFACT_SERIES_NAME%-%INFORMATIONAL_VERSION%%PLATFORM_SUFFIX%"
58+
- if NOT "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_PROJECT%-%CI_TAG%-%SHORT_COMMIT%%PLATFORM_SUFFIX%"
5859
- SET "ESTIMATED_ARTIFACT_URL=https://ci.appveyor.com/api/buildjobs/%APPVEYOR_JOB_ID%/artifacts/%ARTIFACT_NAME%.zip"
5960
- echo. && echo. && echo Estimated upload URL && echo. && echo %ESTIMATED_ARTIFACT_URL% && echo. && echo.
6061
- echo "GIT_COMMIT=%GIT_COMMIT%" && echo "CI_STRING=%CI_STRING%" && echo "CI_TAG=%CI_TAG%" && echo "CI_RELATED_BRANCH=%CI_RELATED_BRANCH%" && echo "CI_PULL_REQUEST_INFO=%CI_PULL_REQUEST_INFO%" && echo "ARTIFACT_SERIES_NAME=%ARTIFACT_SERIES_NAME%"
@@ -105,25 +106,38 @@ nuget:
105106
configuration: Release
106107

107108
before_build:
108-
- dotnet restore src/Imageflow.dnfull.sln
109-
- nuget restore tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj -SolutionDirectory src
109+
- dotnet restore src/Imageflow.dncore.sln
110+
- nuget restore tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj -SolutionDirectory src
111+
112+
110113

111114
build:
112115
parallel: true # enable MSBuild parallel builds
113116
project: src/Imageflow.dnfull.sln # path to Visual Studio solution or project
114117
publish_nuget: true # package projects with .nuspec files and push to artifacts
115118
publish_nuget_symbols: true # generate and publish NuGet symbol packages
116-
include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts
119+
120+
test_script:
121+
- dotnet test tests/Imageflow.Test/ -c Debug
122+
- dotnet test tests/Imageflow.Test/ -c Release
123+
- vstest.console /logger:Appveyor tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll
124+
- vstest.console /logger:Appveyor /Platform:x86 tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll
125+
- vstest.console /logger:Appveyor /Platform:x64 tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll
126+
127+
after_test:
128+
- cd %APPVEYOR_BUILD_FOLDER%
129+
- rmdir /q /s .\artifacts || exit 0
130+
- mkdir .\artifacts\staging\
131+
- xcopy /Y src\Imageflow\bin\Release\netstandard2.0\*.pdb artifacts\staging\ || exit 0
132+
- xcopy /Y src\Imageflow\bin\Release\netstandard2.0\*.dll artifacts\staging\
133+
- cd artifacts\staging
134+
- 7z a -r "..\..\%ARTIFACT_NAME%.zip" *
135+
- cd %APPVEYOR_BUILD_FOLDER%
136+
- appveyor PushArtifact "%ARTIFACT_NAME%.zip"
117137

118138
#TODO: consider DocFx integration https://github.com/docascode/docfx-seed
119139

120-
artifacts:
121-
- path: src\Imageflow\bin\Release\
122-
name: $(ARTIFACT_NAME).zip
123140

124-
# pushing all *.nupkg files in build directory recursively
125-
- path: '**\*.nupkg'
126-
name: NuGet Packages
127141
deploy:
128142
- provider: GitHub
129143
description: 'imageflow-win'
@@ -136,7 +150,7 @@ deploy:
136150
appveyor_repo_tag: true
137151
- provider: NuGet
138152
api_key:
139-
secure: vQj0uASp+URSv7pV5idYAZsdZlTigr/2uPZbnsVFrct7QwvPsa5Ljv39j4m7VlTv
153+
secure: zt4gFjTYP5SEaIXC/fsAYXXg6T1Bibv7qz2p9SvtURcPhrYVhtjREq3EZbIv1jy5
140154
skip_symbols: true
141155
artifact: /.*\.nupkg/
142156
on:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": ".NET Core Launch (console)",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
10+
"args": [],
11+
"cwd": "${workspaceRoot}",
12+
"stopAtEntry": false,
13+
"externalConsole": false
14+
},
15+
{
16+
"name": ".NET Core Launch (web)",
17+
"type": "coreclr",
18+
"request": "launch",
19+
"preLaunchTask": "build",
20+
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
21+
"args": [],
22+
"cwd": "${workspaceRoot}",
23+
"stopAtEntry": false,
24+
"launchBrowser": {
25+
"enabled": true,
26+
"args": "${auto-detect-url}",
27+
"windows": {
28+
"command": "cmd.exe",
29+
"args": "/C start ${auto-detect-url}"
30+
},
31+
"osx": {
32+
"command": "open"
33+
},
34+
"linux": {
35+
"command": "xdg-open"
36+
}
37+
},
38+
"env": {
39+
"ASPNETCORE_ENVIRONMENT": "Development"
40+
},
41+
"sourceFileMap": {
42+
"/Views": "${workspaceRoot}/Views"
43+
}
44+
},
45+
{
46+
"name": ".NET Core Attach",
47+
"type": "coreclr",
48+
"request": "attach",
49+
"processId": "${command.pickProcess}"
50+
}
51+
]
52+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": ".NET Core Launch (console)",
6+
"type": "coreclr",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
10+
"args": [],
11+
"cwd": "${workspaceRoot}",
12+
"externalConsole": false,
13+
"stopAtEntry": false,
14+
"internalConsoleOptions": "openOnSessionStart"
15+
},
16+
{
17+
"name": ".NET Core Attach",
18+
"type": "coreclr",
19+
"request": "attach",
20+
"processId": "${command.pickProcess}"
21+
}
22+
]
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.1.0",
3+
"command": "dotnet",
4+
"isShellCommand": true,
5+
"args": [],
6+
"tasks": [
7+
{
8+
"taskName": "build",
9+
"args": [
10+
""
11+
],
12+
"isBuildCommand": true,
13+
"problemMatcher": "$msCompile"
14+
}
15+
]
16+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System;
2+
3+
namespace Imageflow
4+
{
5+
/// <summary>
6+
/// The exception that is thrown when a native buffer is too large to be marshaled into a managed byte array.
7+
/// </summary>
8+
/// <seealso cref="Exception" />
9+
public class BufferOverflowException : Exception
10+
{
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="BufferOverflowException"/> class.
13+
/// </summary>
14+
/// <param name="bufferSize">Size of the buffer.</param>
15+
public BufferOverflowException(long bufferSize)
16+
{
17+
BufferSize = bufferSize;
18+
}
19+
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="BufferOverflowException"/> class.
22+
/// </summary>
23+
/// <param name="message">The message.</param>
24+
/// <param name="bufferSize">Size of the buffer.</param>
25+
public BufferOverflowException(string message, long bufferSize) : base(message)
26+
{
27+
BufferSize = bufferSize;
28+
}
29+
30+
/// <summary>
31+
/// Initializes a new instance of the <see cref="BufferOverflowException"/> class.
32+
/// </summary>
33+
/// <param name="message">The message.</param>
34+
/// <param name="bufferSize">Size of the buffer.</param>
35+
/// <param name="innerException">The inner exception.</param>
36+
public BufferOverflowException(string message, long bufferSize, Exception innerException) : base(message, innerException)
37+
{
38+
BufferSize = bufferSize;
39+
}
40+
41+
/// <summary>
42+
/// Gets the size of the buffer.
43+
/// </summary>
44+
/// <value>
45+
/// The size of the buffer.
46+
/// </value>
47+
public long BufferSize
48+
{
49+
get;
50+
}
51+
52+
/// <summary>
53+
/// Gets a message that describes the current exception.
54+
/// </summary>
55+
public override string Message => $"The native buffer was too large to be marshaled into a managed byte array. Native Buffer Size: {BufferSize}.";
56+
}
57+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma warning disable HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation
2+
using System;
3+
using Newtonsoft.Json;
4+
5+
namespace Imageflow
6+
{
7+
/// <summary>
8+
/// Common Exceptions
9+
/// </summary>
10+
internal static class Exceptions
11+
{
12+
/// <summary>
13+
/// Parameter is not the correct.
14+
/// </summary>
15+
/// <typeparam name="TWantedType">The type of the wanted type.</typeparam>
16+
/// <param name="nameOfParameter">The name of parameter.</param>
17+
/// <returns>An <see cref="ArgumentException"/> with filled in message and parameter.</returns>
18+
public static ArgumentException ParameterIsNotTheCorrectType<TWantedType>(string nameOfParameter) => new ArgumentException($"{nameOfParameter} is not an {typeof(TWantedType).Name}.");
19+
20+
/// <summary>
21+
/// No value for JSON property.
22+
/// </summary>
23+
/// <param name="propertyName">Name of the property.</param>
24+
/// <returns>A <see cref="JsonException"/> with filled message.</returns>
25+
public static JsonException NoValue(string propertyName) => new JsonException($"No value for property {propertyName}.");
26+
}
27+
}
28+
#pragma warning restore HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+

2+
// This file is used by Code Analysis to maintain SuppressMessage
3+
// attributes that are applied to this project.
4+
// Project-level suppressions either have no target or are given
5+
// a specific target and scoped to a namespace, type, member, etc.
6+
7+
using System.Diagnostics.CodeAnalysis;
8+
9+
[assembly: SuppressMessage("Style", "CC0105:You should use 'var' whenever possible.", Justification = "var is only useful with IDEs")]
10+
[assembly: SuppressMessage("Style", "CC0001:You should use 'var' whenever possible.", Justification = "var is only useful with IDEs")]
11+
[assembly: SuppressMessage("Language Usage Opportunities", "RECS0091:Use 'var' keyword when possible", Justification = "var is only useful with IDEs")]
12+
[assembly: SuppressMessage("Style", "RECS0129: C# modifier is redundant", Justification = "Modifiers should always be explicitly stated")]
13+
[assembly: SuppressMessage("Style", "RECS0145: C# 'private' modifier is redundant", Justification = "Modifiers should always be explicitly stated")]
14+
[assembly: SuppressMessage("Maintainability", "S1309:Track uses of in-source issue suppressions", Justification = "Redunent")]
15+
[assembly: SuppressMessage("General", "RCS1024:Format accessor list.", Justification = "LINES")]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Description>Imageflow brings world-class image quality and performance to all languages through a C-compatible API (libimageflow) and a separate RESTful turnkey HTTP server and command-line tool. Linux, Mac, and Windows are supported.</Description>
5+
<Copyright>Copyright 2016 Imazen</Copyright>
6+
<AssemblyTitle>Imageflow</AssemblyTitle>
7+
<Authors>Imazen</Authors>
8+
<TargetFramework>netstandard1.3</TargetFramework>
9+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
10+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11+
<AssemblyName>Imageflow</AssemblyName>
12+
<PackageId>Imageflow</PackageId>
13+
<PackageTags>Imazen;Imageflow</PackageTags>
14+
<PackageIconUrl>https://www.imageflow.io/images/imageflow-icon.png</PackageIconUrl>
15+
<PackageLicenseUrl>https://github.com/imazen/imageflow/blob/master/LICENSE</PackageLicenseUrl>
16+
<RepositoryType>git</RepositoryType>
17+
<RepositoryUrl>https://github.com/imazen/imageflow</RepositoryUrl>
18+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
19+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
20+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<PackageReference Include="EWSoftware.SHFB" Version="2017.5.15">
25+
<PrivateAssets>All</PrivateAssets>
26+
</PackageReference>
27+
<PackageReference Include="EWSoftware.SHFB.NETCore" Version="4.5.1">
28+
<PrivateAssets>All</PrivateAssets>
29+
</PackageReference>
30+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
31+
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0">
32+
<IncludeAssets>Compile</IncludeAssets>
33+
</PackageReference>
34+
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
35+
<PackageReference Include="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
36+
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
37+
<PackageReference Include="System.Threading" Version="4.3.0" />
38+
</ItemGroup>
39+
</Project>

0 commit comments

Comments
 (0)