Skip to content

Commit

Permalink
implemented embeded encoder assembly resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Odoom committed Sep 10, 2021
1 parent 83050c8 commit 5fdbf29
Show file tree
Hide file tree
Showing 53 changed files with 1,033 additions and 2,023 deletions.
14 changes: 8 additions & 6 deletions client/console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using Libwebp.Net;

using Libwebp.Net;
using Libwebp.Standard;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;

namespace console
Expand Down Expand Up @@ -32,14 +35,13 @@ static async Task Main(string[] args)
// pass the inmemory file to the encoder
var output = await encoder.EncodeAsync(ms, Path.GetFileName(file.Name));

/* your converted file is returned as FileStream, do what you want download, copy to disk
or save on cloud storage*/
Console.WriteLine($"Your output file : {Path.GetFileName(output.Name)}");
/* your converted file is returned as FileStream, do what you want download, copy to disk
or save on cloud storage*/

Console.WriteLine($"Your output file : {Path.GetFileName(output.Name)}");
Console.WriteLine($"Length in bytes : {output.Length}");
Console.WriteLine($"You saved {file.Length - output.Length} bytes after compression");


}
}
}
13 changes: 8 additions & 5 deletions client/console/bin/Debug/net5.0/console.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
".NETCoreApp,Version=v5.0": {
"console/1.0.0": {
"dependencies": {
"Libwebp.Net": "1.0.0"
"DummyBin": "1.0.0.0"
},
"runtime": {
"console.dll": {}
}
},
"Libwebp.Net/1.0.0": {
"DummyBin/1.0.0.0": {
"runtime": {
"Libwebp.Net.dll": {}
"DummyBin.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
}
}
Expand All @@ -27,8 +30,8 @@
"serviceable": false,
"sha512": ""
},
"Libwebp.Net/1.0.0": {
"type": "project",
"DummyBin/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
}
Expand Down
8 changes: 7 additions & 1 deletion client/console/console.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -20,4 +20,10 @@
<ProjectReference Include="..\..\src\Libwebp.Net.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="DummyBin">
<HintPath>..\..\DummyBin\bin\Debug\net5.0\DummyBin.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\conso
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\console.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\ref\console.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\console.pdb
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.csproj.AssemblyReference.cache
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.AssemblyInfoInputs.cache
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.AssemblyInfo.cs
Expand All @@ -14,11 +13,7 @@ C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\conso
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\ref\console.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.pdb
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.genruntimeconfig.cache
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\codecs\cwebp.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\codecs\freeglut.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\codecs\gif2webp.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\codecs\vwebp.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\codecs\webpmux.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\Libwebp.Net.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\Libwebp.Net.pdb
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\DummyBin.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Debug\net5.0\DummyBin.pdb
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.csproj.AssemblyReference.cache
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Debug\net5.0\console.csproj.CopyComplete
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\freeglut.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\gif2webp.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\vwebp.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\webpmux.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\windows\freeglut.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\console.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\cwebp.exe
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\console.deps.json
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\console.runtimeconfig.json
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\console.runtimeconfig.dev.json
Expand All @@ -22,3 +18,4 @@ C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Release\net5.0\con
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Release\net5.0\ref\console.dll
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Release\net5.0\console.pdb
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\obj\Release\net5.0\console.genruntimeconfig.cache
C:\Users\fodoo\Desktop\Lab\OSP\libwebp.net\client\console\bin\Release\net5.0\codecs\windows\cwebp.exe
8 changes: 3 additions & 5 deletions client/console/obj/console.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
"net5.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
"C:\\Users\\fodoo\\Desktop": {}
},
"frameworks": {
"net5.0": {
Expand Down Expand Up @@ -70,7 +69,7 @@
}
},
"C:\\Users\\fodoo\\Desktop\\Lab\\OSP\\libwebp.net\\src\\Libwebp.Net.csproj": {
"version": "1.0.0",
"version": "0.9.0",
"restore": {
"projectUniqueName": "C:\\Users\\fodoo\\Desktop\\Lab\\OSP\\libwebp.net\\src\\Libwebp.Net.csproj",
"projectName": "Libwebp.Net",
Expand All @@ -93,8 +92,7 @@
"net5.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
"C:\\Users\\fodoo\\Desktop": {}
},
"frameworks": {
"net5.0": {
Expand Down
9 changes: 4 additions & 5 deletions client/console/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 3,
"targets": {
"net5.0": {
"Libwebp.Net/1.0.0": {
"Libwebp.Net/0.9.0": {
"type": "project",
"framework": ".NETCoreApp,Version=v5.0",
"compile": {
Expand All @@ -15,15 +15,15 @@
}
},
"libraries": {
"Libwebp.Net/1.0.0": {
"Libwebp.Net/0.9.0": {
"type": "project",
"path": "../../src/Libwebp.Net.csproj",
"msbuildProject": "../../src/Libwebp.Net.csproj"
}
},
"projectFileDependencyGroups": {
"net5.0": [
"Libwebp.Net >= 1.0.0"
"Libwebp.Net >= 0.9.0"
]
},
"packageFolders": {
Expand Down Expand Up @@ -56,8 +56,7 @@
"net5.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
"C:\\Users\\fodoo\\Desktop": {}
},
"frameworks": {
"net5.0": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>ZipDeploy</WebPublishMethod>
<IsLinux>true</IsLinux>
<ResourceId>/subscriptions/16d19ae7-d3c5-41d2-b93d-799fb42ef567/resourceGroups/labs/providers/Microsoft.Web/sites/crosslibwebp</ResourceId>
<ResourceGroup>labs</ResourceGroup>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<SiteUrlToLaunchAfterPublish>http://crosslibwebp.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<ProjectGuid>6a322781-0186-40dd-8d33-c0eb4ac1b31a</ProjectGuid>
<PublishUrl>https://crosslibwebp.scm.azurewebsites.net/</PublishUrl>
<UserName>$crosslibwebp</UserName>
<_SavePWD>True</_SavePWD>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_dependencyType": "function.linux.appService"
},
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "labs",
"metadata": {
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "westeurope",
"metadata": {
"description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
}
},
"resourceName": {
"type": "string",
"defaultValue": "crosslibwebp",
"metadata": {
"description": "Name of the main resource to be created by this template."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"expressionEvaluationOptions": {
"scope": "inner"
},
"parameters": {
"resourceGroupName": {
"value": "[parameters('resourceGroupName')]"
},
"resourceGroupLocation": {
"value": "[parameters('resourceGroupLocation')]"
},
"resourceName": {
"value": "[parameters('resourceName')]"
},
"resourceLocation": {
"value": "[parameters('resourceLocation')]"
}
},
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string"
},
"resourceGroupLocation": {
"type": "string"
},
"resourceName": {
"type": "string"
},
"resourceLocation": {
"type": "string"
}
},
"variables": {
"storage_name": "[toLower(concat('storage', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId))))]",
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
"storage_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Storage/storageAccounts/', variables('storage_name'))]",
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]",
"function_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/sites/', parameters('resourceName'))]"
},
"resources": [
{
"location": "[parameters('resourceLocation')]",
"name": "[parameters('resourceName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2015-08-01",
"tags": {
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
},
"dependsOn": [
"[variables('appServicePlan_ResourceId')]",
"[variables('storage_ResourceId')]"
],
"kind": "functionapp",
"properties": {
"name": "[parameters('resourceName')]",
"kind": "functionapp",
"httpsOnly": true,
"reserved": false,
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
"siteConfig": {
"alwaysOn": true,
"linuxFxVersion": "dotnet|3.1"
}
},
"identity": {
"type": "SystemAssigned"
},
"resources": [
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[variables('function_ResourceId')]"
],
"properties": {
"AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storage_name'), ';AccountKey=', listKeys(variables('storage_ResourceId'), '2017-10-01').keys[0].value, ';EndpointSuffix=', 'core.windows.net')]",
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storage_name'), ';AccountKey=', listKeys(variables('storage_ResourceId'), '2017-10-01').keys[0].value, ';EndpointSuffix=', 'core.windows.net')]",
"FUNCTIONS_EXTENSION_VERSION": "~3",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
]
},
{
"location": "[parameters('resourceGroupLocation')]",
"name": "[variables('storage_name')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2017-10-01",
"tags": {
"[concat('hidden-related:', concat('/providers/Microsoft.Web/sites/', parameters('resourceName')))]": "empty"
},
"properties": {
"supportsHttpsTrafficOnly": true
},
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage"
},
{
"location": "[parameters('resourceGroupLocation')]",
"name": "[variables('appServicePlan_name')]",
"type": "Microsoft.Web/serverFarms",
"apiVersion": "2015-02-01",
"kind": "linux",
"properties": {
"name": "[variables('appServicePlan_name')]",
"sku": "Standard",
"workerSizeId": "0",
"reserved": true
}
}
]
}
}
}
]
}
Loading

0 comments on commit 5fdbf29

Please sign in to comment.