Target netstandard2.1 and net5.0 in ImageCore

This commit is contained in:
Denis-Cosmin Nutiu 2022-01-27 23:04:05 +02:00
parent e4bc3fafe2
commit b43deb9cb8
8 changed files with 15 additions and 14 deletions

View file

@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<AssemblyName>metadata_remover</AssemblyName> <AssemblyName>metadata_remover</AssemblyName>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishReadyToRun>true</PublishReadyToRun> <PublishReadyToRun>true</PublishReadyToRun>
<TargetFrameworks>net5.0;netstandard2.1</TargetFrameworks>
<LangVersion>7.3</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<OutputType>Library</OutputType>
<LangVersion>8</LangVersion>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,4 @@
using System; using System;
using Image;
using Image.Output; using Image.Output;
using Xunit; using Xunit;

View file

@ -9,6 +9,6 @@
/// The method compresses an image in place. /// The method compresses an image in place.
/// </summary> /// </summary>
/// <param name="fileName">The file name of the image to be compressed.</param> /// <param name="fileName">The file name of the image to be compressed.</param>
public void Compress(string fileName); void Compress(string fileName);
} }
} }

View file

@ -7,7 +7,7 @@ namespace Image.Compressor
/// </summary> /// </summary>
public class LosslessCompressor : ICompressor public class LosslessCompressor : ICompressor
{ {
public static readonly LosslessCompressor Instance = new(); public static readonly LosslessCompressor Instance;
private readonly ImageOptimizer _imageOptimizer; private readonly ImageOptimizer _imageOptimizer;
public LosslessCompressor() public LosslessCompressor()

View file

@ -5,7 +5,7 @@
/// </summary> /// </summary>
public class NullCompressor : ICompressor public class NullCompressor : ICompressor
{ {
public static readonly NullCompressor Instance = new(); public static readonly NullCompressor Instance;
/// <summary> /// <summary>
/// <inheritdoc /> /// <inheritdoc />

View file

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Image</RootNamespace> <RootNamespace>Image</RootNamespace>
<TargetFrameworks>net5.0;netstandard2.1</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Guard.Net" Version="2.0.0" /> <PackageReference Include="Ardalis.GuardClauses" Version="4.0.0" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="8.6.1" /> <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="8.6.1" />
<PackageReference Include="Magick.NET.Core" Version="8.6.1" /> <PackageReference Include="Magick.NET.Core" Version="8.6.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />

View file

@ -1,5 +1,5 @@
using System.IO; using System.IO;
using GuardNet; using Ardalis.GuardClauses;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
@ -35,9 +35,10 @@ namespace Image.Output
public string GetOutputPath(string initialFilePath) public string GetOutputPath(string initialFilePath)
{ {
Logger.LogDebug($"KeepFilenameFormatter - {_outputDirectory} - {initialFilePath}"); Logger.LogDebug($"KeepFilenameFormatter - {_outputDirectory} - {initialFilePath}");
Guard.NotNullOrEmpty(initialFilePath, nameof(initialFilePath)); Guard.Against.NullOrEmpty(initialFilePath, nameof(initialFilePath));
var fileName = Path.GetFileName(initialFilePath)?.Split(".")[0]; var fileName = Path.GetFileName(initialFilePath)?.Split('.')[0];
var path = Path.Join(_outputDirectory, $"{fileName}.jpg"); var path = Path.Combine(_outputDirectory, $"{fileName}.jpg");
return path; return path;
} }