Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Sep 13, 2017
2 parents 19eb749 + f155a50 commit 8dd79ae
Show file tree
Hide file tree
Showing 35 changed files with 2,349 additions and 12 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,18 @@
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.


```
PM> Install-Package Imageflow.Net
PM> Install-Package Imageflow.NativeRuntime.win-x86
PM> Install-Package Imageflow.NativeRuntime.win-x86_64-sandybridge
PM> Install-Package Imageflow.NativeRuntime.osx_10_11-x86_64
PM> Install-Package Imageflow.NativeRuntime.ubuntu_14_04-x86_64
```

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.

[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.


* [Project source and issue site](https://github.com/imazen/imageflow-dotnet)
* [Stack Overflow tag](http://stackoverflow.com/questions/tagged/imageflow.net) - for specific "How do I do X?" questions
38 changes: 26 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ install:
- 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%"
- SET "CI_TAG=%APPVEYOR_REPO_TAG_NAME%"
- SET "CI_REPO=%APPVEYOR_REPO_NAME%"
- SET "CI_PROJECT=%APPVEYOR_PROJECT_NAME%"
- SET "CI_RELATED_BRANCH=%APPVEYOR_REPO_BRANCH%"
- SET "CI_PULL_REQUEST_INFO=%APPVEYOR_PULL_REQUEST_NUMBER%"
- SET "GIT_OPTIONAL_BRANCH="
Expand All @@ -53,8 +54,8 @@ install:
- SET "PLATFORM_SUFFIX=%OS_SPECIFIC_SUFFIX%-%PLATFORM%"
- if "%PLATFORM%"=="Any CPU" SET "PLATFORM_SUFFIX=%OS_SPECIFIC_SUFFIX%"
- if "%PLATFORM%"=="" SET "PLATFORM_SUFFIX=%OS_SPECIFIC_SUFFIX%"
- if "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_REPO%-build-%PADDED_BUILD_NUMBER%-%ARTIFACT_SERIES_NAME%-%INFORMATIONAL_VERSION%%PLATFORM_SUFFIX%"
- if NOT "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_REPO%-%CI_TAG%-%SHORT_COMMIT%%PLATFORM_SUFFIX%"
- if "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_PROJECT%-build-%PADDED_BUILD_NUMBER%-%ARTIFACT_SERIES_NAME%-%INFORMATIONAL_VERSION%%PLATFORM_SUFFIX%"
- if NOT "%CI_TAG%"=="" SET "ARTIFACT_NAME=%CI_PROJECT%-%CI_TAG%-%SHORT_COMMIT%%PLATFORM_SUFFIX%"
- SET "ESTIMATED_ARTIFACT_URL=https://ci.appveyor.com/api/buildjobs/%APPVEYOR_JOB_ID%/artifacts/%ARTIFACT_NAME%.zip"
- echo. && echo. && echo Estimated upload URL && echo. && echo %ESTIMATED_ARTIFACT_URL% && echo. && echo.
- 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%"
Expand Down Expand Up @@ -105,25 +106,38 @@ nuget:
configuration: Release

before_build:
- dotnet restore src/Imageflow.dnfull.sln
- nuget restore tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj -SolutionDirectory src
- dotnet restore src/Imageflow.dncore.sln
- nuget restore tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj -SolutionDirectory src



build:
parallel: true # enable MSBuild parallel builds
project: src/Imageflow.dnfull.sln # path to Visual Studio solution or project
publish_nuget: true # package projects with .nuspec files and push to artifacts
publish_nuget_symbols: true # generate and publish NuGet symbol packages
include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts

test_script:
- dotnet test tests/Imageflow.Test/ -c Debug
- dotnet test tests/Imageflow.Test/ -c Release
- vstest.console /logger:Appveyor tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll
- vstest.console /logger:Appveyor /Platform:x86 tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll
- vstest.console /logger:Appveyor /Platform:x64 tests\Imageflow.TestDotNetFull\bin\Release\Imageflow.TestDotNetFull.dll

after_test:
- cd %APPVEYOR_BUILD_FOLDER%
- rmdir /q /s .\artifacts || exit 0
- mkdir .\artifacts\staging\
- xcopy /Y src\Imageflow\bin\Release\netstandard2.0\*.pdb artifacts\staging\ || exit 0
- xcopy /Y src\Imageflow\bin\Release\netstandard2.0\*.dll artifacts\staging\
- cd artifacts\staging
- 7z a -r "..\..\%ARTIFACT_NAME%.zip" *
- cd %APPVEYOR_BUILD_FOLDER%
- appveyor PushArtifact "%ARTIFACT_NAME%.zip"

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

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

# pushing all *.nupkg files in build directory recursively
- path: '**\*.nupkg'
name: NuGet Packages
deploy:
- provider: GitHub
description: 'imageflow-win'
Expand All @@ -136,7 +150,7 @@ deploy:
appveyor_repo_tag: true
- provider: NuGet
api_key:
secure: vQj0uASp+URSv7pV5idYAZsdZlTigr/2uPZbnsVFrct7QwvPsa5Ljv39j4m7VlTv
secure: zt4gFjTYP5SEaIXC/fsAYXXg6T1Bibv7qz2p9SvtURcPhrYVhtjREq3EZbIv1jy5
skip_symbols: true
artifact: /.*\.nupkg/
on:
Expand Down
52 changes: 52 additions & 0 deletions contrib/contrib_bindings/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}
23 changes: 23 additions & 0 deletions contrib/contrib_bindings/Imageflow/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"externalConsole": false,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}
16 changes: 16 additions & 0 deletions contrib/contrib_bindings/Imageflow/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
""
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
57 changes: 57 additions & 0 deletions contrib/contrib_bindings/Imageflow/BufferOverflowException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;

namespace Imageflow
{
/// <summary>
/// The exception that is thrown when a native buffer is too large to be marshaled into a managed byte array.
/// </summary>
/// <seealso cref="Exception" />
public class BufferOverflowException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="BufferOverflowException"/> class.
/// </summary>
/// <param name="bufferSize">Size of the buffer.</param>
public BufferOverflowException(long bufferSize)
{
BufferSize = bufferSize;
}

/// <summary>
/// Initializes a new instance of the <see cref="BufferOverflowException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="bufferSize">Size of the buffer.</param>
public BufferOverflowException(string message, long bufferSize) : base(message)
{
BufferSize = bufferSize;
}

/// <summary>
/// Initializes a new instance of the <see cref="BufferOverflowException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="bufferSize">Size of the buffer.</param>
/// <param name="innerException">The inner exception.</param>
public BufferOverflowException(string message, long bufferSize, Exception innerException) : base(message, innerException)
{
BufferSize = bufferSize;
}

/// <summary>
/// Gets the size of the buffer.
/// </summary>
/// <value>
/// The size of the buffer.
/// </value>
public long BufferSize
{
get;
}

/// <summary>
/// Gets a message that describes the current exception.
/// </summary>
public override string Message => $"The native buffer was too large to be marshaled into a managed byte array. Native Buffer Size: {BufferSize}.";
}
}
28 changes: 28 additions & 0 deletions contrib/contrib_bindings/Imageflow/Exceptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma warning disable HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation
using System;
using Newtonsoft.Json;

namespace Imageflow
{
/// <summary>
/// Common Exceptions
/// </summary>
internal static class Exceptions
{
/// <summary>
/// Parameter is not the correct.
/// </summary>
/// <typeparam name="TWantedType">The type of the wanted type.</typeparam>
/// <param name="nameOfParameter">The name of parameter.</param>
/// <returns>An <see cref="ArgumentException"/> with filled in message and parameter.</returns>
public static ArgumentException ParameterIsNotTheCorrectType<TWantedType>(string nameOfParameter) => new ArgumentException($"{nameOfParameter} is not an {typeof(TWantedType).Name}.");

/// <summary>
/// No value for JSON property.
/// </summary>
/// <param name="propertyName">Name of the property.</param>
/// <returns>A <see cref="JsonException"/> with filled message.</returns>
public static JsonException NoValue(string propertyName) => new JsonException($"No value for property {propertyName}.");
}
}
#pragma warning restore HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation
15 changes: 15 additions & 0 deletions contrib/contrib_bindings/Imageflow/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Style", "CC0105:You should use 'var' whenever possible.", Justification = "var is only useful with IDEs")]
[assembly: SuppressMessage("Style", "CC0001:You should use 'var' whenever possible.", Justification = "var is only useful with IDEs")]
[assembly: SuppressMessage("Language Usage Opportunities", "RECS0091:Use 'var' keyword when possible", Justification = "var is only useful with IDEs")]
[assembly: SuppressMessage("Style", "RECS0129: C# modifier is redundant", Justification = "Modifiers should always be explicitly stated")]
[assembly: SuppressMessage("Style", "RECS0145: C# 'private' modifier is redundant", Justification = "Modifiers should always be explicitly stated")]
[assembly: SuppressMessage("Maintainability", "S1309:Track uses of in-source issue suppressions", Justification = "Redunent")]
[assembly: SuppressMessage("General", "RCS1024:Format accessor list.", Justification = "LINES")]
39 changes: 39 additions & 0 deletions contrib/contrib_bindings/Imageflow/Imageflow.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<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>
<Copyright>Copyright 2016 Imazen</Copyright>
<AssemblyTitle>Imageflow</AssemblyTitle>
<Authors>Imazen</Authors>
<TargetFramework>netstandard1.3</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Imageflow</AssemblyName>
<PackageId>Imageflow</PackageId>
<PackageTags>Imazen;Imageflow</PackageTags>
<PackageIconUrl>https://www.imageflow.io/images/imageflow-icon.png</PackageIconUrl>
<PackageLicenseUrl>https://github.com/imazen/imageflow/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/imazen/imageflow</RepositoryUrl>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EWSoftware.SHFB" Version="2017.5.15">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="EWSoftware.SHFB.NETCore" Version="4.5.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0">
<IncludeAssets>Compile</IncludeAssets>
</PackageReference>
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit 8dd79ae

Please sign in to comment.