Replacing dependency on System.Drawing with SixLabors.ImageSharp based on cross platform guidance from Microsoft 9b4520703c/accepted/2021/system-drawing-win-only/system-drawing-win-only.md

This commit is contained in:
Shaun Walker
2021-09-02 11:58:31 -04:00
parent d29dc9d036
commit 233da1508b
4 changed files with 10 additions and 12 deletions

View File

@ -19,10 +19,10 @@
</div> </div>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
</TabPanel> </TabPanel>
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate> <TabPanel Name="Download" Heading="Download Files" ResourceKey="DownloadFiles">
<TabPanel Name="Download" Heading="Download Files" ResourceKey="DownloadFiles"> @if (_folders != null)
@if (_folders != null) {
{ <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
<div class="container"> <div class="container">
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="url" HelpText="Enter the url of the file you wish to download" ResourceKey="Url">Url: </Label> <Label Class="col-sm-3" For="url" HelpText="Enter the url of the file you wish to download" ResourceKey="Url">Url: </Label>
@ -45,9 +45,9 @@
</div> </div>
<button type="button" class="btn btn-success" @onclick="Download">@SharedLocalizer["Download"]</button> <button type="button" class="btn btn-success" @onclick="Download">@SharedLocalizer["Download"]</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
} </form>
</TabPanel> }
</form> </TabPanel>
</TabStrip> </TabStrip>
@code { @code {

View File

@ -3,7 +3,6 @@ del "*.zip"
dotnet clean -c Release ..\Oqtane.sln dotnet clean -c Release ..\Oqtane.sln
dotnet build -c Release ..\Oqtane.Databases.sln dotnet build -c Release ..\Oqtane.Databases.sln
dotnet build -c Release ..\Oqtane.sln dotnet build -c Release ..\Oqtane.sln
copy /Y/B/V "..\Oqtane.Server\bin\Release\net5.0\System.Drawing.Common.dll" "..\Oqtane.Server\bin\Release\net5.0\publish\System.Drawing.Common.dll"
nuget.exe pack Oqtane.Client.nuspec nuget.exe pack Oqtane.Client.nuspec
nuget.exe pack Oqtane.Server.nuspec nuget.exe pack Oqtane.Server.nuspec
nuget.exe pack Oqtane.Shared.nuspec nuget.exe pack Oqtane.Shared.nuspec

View File

@ -11,12 +11,12 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Oqtane.Security; using Oqtane.Security;
using System.Linq; using System.Linq;
using System.Drawing;
using System.Net; using System.Net;
using Oqtane.Enums; using Oqtane.Enums;
using Oqtane.Infrastructure; using Oqtane.Infrastructure;
using Oqtane.Repository; using Oqtane.Repository;
using Oqtane.Extensions; using Oqtane.Extensions;
using SixLabors.ImageSharp;
// ReSharper disable StringIndexOfIsCultureSpecific.1 // ReSharper disable StringIndexOfIsCultureSpecific.1
@ -517,12 +517,11 @@ namespace Oqtane.Controllers
if (Constants.ImageFiles.Split(',').Contains(file.Extension.ToLower())) if (Constants.ImageFiles.Split(',').Contains(file.Extension.ToLower()))
{ {
FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read); FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
using (var image = Image.FromStream(stream)) using (Image image = Image.Load(stream))
{ {
file.ImageHeight = image.Height; file.ImageHeight = image.Height;
file.ImageWidth = image.Width; file.ImageWidth = image.Width;
} }
stream.Close(); stream.Close();
} }

View File

@ -41,9 +41,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.4" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" /> <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" /> <ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" />