Moves zlib to its own nuget (#164)
This commit is contained in:
parent
561b40c3d8
commit
d76d60d900
23 changed files with 75 additions and 398 deletions
21
.github/workflows/dotnet-core.yml
vendored
21
.github/workflows/dotnet-core.yml
vendored
|
|
@ -32,29 +32,12 @@ jobs:
|
|||
with:
|
||||
path: |
|
||||
~/.nuget/packages
|
||||
!~/.nuget/packages/zlib.bindings
|
||||
${{ github.workspace }}/Projects/*/obj/project.assets.json
|
||||
${{ github.workspace }}/Projects/*/obj/project.nuget.cache
|
||||
${{ github.workspace }}/Projects/*/obj/*.csproj.nuget.*
|
||||
key: ${{ matrix.os }}-nuget-cache-v6-${{ hashFiles('**/packages.lock.json') }}
|
||||
key: ${{ matrix.os }}-nuget-cache-v7-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ matrix.os }}-nuget-cache-v3
|
||||
- name: ZLib Library Cache
|
||||
id: zlib-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.nuget/packages/zlib.bindings
|
||||
${{ github.workspace }}/Projects/ZLib/**
|
||||
${{ github.workspace }}/packages/ZLib.Bindings*.nupkg
|
||||
key: ${{ matrix.os }}-zlib-cache-v6-${{ hashFiles('Projects/ZLib/*') }}
|
||||
restore-keys: |
|
||||
${{ matrix.os }}-zlib-cache-v4
|
||||
- name: Build ZLib
|
||||
run: dotnet build -c Release Projects/ZLib/ZLib.csproj
|
||||
- name: Pack ZLib NuGet
|
||||
if: steps.zlib-cache.outputs.cache-hit != 'true'
|
||||
run: dotnet pack -c Release -o packages Projects/ZLib/ZLib.csproj
|
||||
${{ matrix.os }}-nuget-cache-v7
|
||||
- name: Restore dependencies
|
||||
if: steps.nuget-cache.outputs.cache-hit != 'true' || steps.zlib-cache.outputs.cache-hit != 'true'
|
||||
run: dotnet restore --force-evaluate
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.Tests", "Projects\Se
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UOContent.Tests", "Projects\UOContent.Tests\UOContent.Tests.csproj", "{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zlib", "Projects\ZLib\ZLib.csproj", "{3B030CD2-DB29-4BC2-9C90-D90804B30757}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Analyze|x64 = Analyze|x64
|
||||
|
|
@ -43,12 +41,6 @@ Global
|
|||
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Debug|x64.Build.0 = Debug|x64
|
||||
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Release|x64.ActiveCfg = Release|x64
|
||||
{3C4797F9-603E-44EF-8E8C-9275CC9EA74B}.Release|x64.Build.0 = Release|x64
|
||||
{3B030CD2-DB29-4BC2-9C90-D90804B30757}.Analyze|x64.ActiveCfg = Analyze|x64
|
||||
{3B030CD2-DB29-4BC2-9C90-D90804B30757}.Analyze|x64.Build.0 = Analyze|x64
|
||||
{3B030CD2-DB29-4BC2-9C90-D90804B30757}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3B030CD2-DB29-4BC2-9C90-D90804B30757}.Debug|x64.Build.0 = Debug|x64
|
||||
{3B030CD2-DB29-4BC2-9C90-D90804B30757}.Release|x64.ActiveCfg = Release|x64
|
||||
{3B030CD2-DB29-4BC2-9C90-D90804B30757}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="local" value="packages" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -1181,10 +1181,10 @@
|
|||
"xunit.extensibility.core": "[2.4.1]"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"ModernUO": {
|
||||
"type": "Project",
|
||||
|
|
@ -1193,7 +1193,7 @@
|
|||
"Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv": "3.1.5",
|
||||
"Microsoft.Extensions.Hosting.Abstractions": "3.1.5",
|
||||
"System.IO.Pipelines": "4.7.2",
|
||||
"ZLib.Bindings": "1.0.2"
|
||||
"Zlib.Bindings": "1.0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -2065,10 +2065,10 @@
|
|||
"runtime.any.System.Threading.Timer": "4.3.0"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/osx-x64": {
|
||||
|
|
@ -2939,10 +2939,10 @@
|
|||
"runtime.any.System.Threading.Timer": "4.3.0"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/win-x64": {
|
||||
|
|
@ -3796,10 +3796,10 @@
|
|||
"runtime.any.System.Threading.Timer": "4.3.0"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ using System;
|
|||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Compression;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
|
|
@ -167,7 +167,7 @@ namespace Server
|
|||
if (compressionMethod == 1)
|
||||
{
|
||||
data = new byte[decompressedSize];
|
||||
ZLib.Unpack(data, ref decompressedSize, sourceData, compressedSize);
|
||||
Zlib.Unpack(data, ref decompressedSize, sourceData, compressedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using Server.Compression;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Network
|
||||
|
|
@ -183,7 +183,7 @@ namespace Server.Network
|
|||
|
||||
var packLength = wantLength;
|
||||
|
||||
ZLib.Pack(packBuffer, ref packLength, buffer, length, ZLibQuality.Default);
|
||||
Zlib.Pack(packBuffer, ref packLength, buffer, length, ZlibQuality.Default);
|
||||
|
||||
Stream.Write(4 + packLength);
|
||||
Stream.Write(length);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.5" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="4.7.2" />
|
||||
<PackageReference Include="ZLib.Bindings" Version="1.0.2" />
|
||||
<PackageReference Include="Zlib.Bindings" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Analyze'">
|
||||
<PackageReference Include="StyleCop.Analyzers">
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@
|
|||
"resolved": "4.7.2",
|
||||
"contentHash": "rGIIhoY3lUdn9rWeuGdgeZZ0P+SpJ1wZI5g8TnXqgvuhFgUP7iP9Nt5FZebYInQZQxqnwjPxdYYBE5l/8PJmqQ=="
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -112,11 +112,11 @@
|
|||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/linux-x64": {
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -128,11 +128,11 @@
|
|||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/osx-x64": {
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -144,11 +144,11 @@
|
|||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/win-x64": {
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
|
|||
|
|
@ -1327,10 +1327,10 @@
|
|||
"xunit.extensibility.core": "[2.4.1]"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"ModernUO": {
|
||||
"type": "Project",
|
||||
|
|
@ -1339,7 +1339,7 @@
|
|||
"Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv": "3.1.5",
|
||||
"Microsoft.Extensions.Hosting.Abstractions": "3.1.5",
|
||||
"System.IO.Pipelines": "4.7.2",
|
||||
"ZLib.Bindings": "1.0.2"
|
||||
"Zlib.Bindings": "1.0.3"
|
||||
}
|
||||
},
|
||||
"uocontent": {
|
||||
|
|
@ -1351,7 +1351,7 @@
|
|||
"Microsoft.Extensions.DependencyInjection.Abstractions": "3.1.5",
|
||||
"Microsoft.Extensions.Hosting.Abstractions": "3.1.5",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "3.1.5",
|
||||
"Zlib.Bindings": "1.0.2"
|
||||
"Zlib.Bindings": "1.0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -2239,10 +2239,10 @@
|
|||
"runtime.any.System.Threading.Timer": "4.3.0"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/osx-x64": {
|
||||
|
|
@ -3129,10 +3129,10 @@
|
|||
"runtime.any.System.Threading.Timer": "4.3.0"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
}
|
||||
},
|
||||
".NETCoreApp,Version=v3.1/win-x64": {
|
||||
|
|
@ -4016,10 +4016,10 @@
|
|||
"runtime.any.System.Threading.Timer": "4.3.0"
|
||||
}
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Buffers;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Server.Gumps;
|
||||
|
|
@ -10,7 +11,6 @@ using Server.Items;
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Compression;
|
||||
|
||||
namespace Server.Multis
|
||||
{
|
||||
|
|
@ -2325,10 +2325,10 @@ namespace Server.Multis
|
|||
byte[] inflatedBuffer = m_PlaneBuffers[i];
|
||||
|
||||
int deflatedLength = m_DeflatedBuffer.Length;
|
||||
ZLibError ce = ZLib.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
|
||||
ZLibQuality.Default);
|
||||
ZlibError ce = Zlib.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
|
||||
ZlibQuality.Default);
|
||||
|
||||
if (ce != ZLibError.Okay)
|
||||
if (ce != ZlibError.Okay)
|
||||
{
|
||||
Console.WriteLine("ZLib error: {0} (#{1})", ce, (int)ce);
|
||||
deflatedLength = 0;
|
||||
|
|
@ -2361,10 +2361,10 @@ namespace Server.Multis
|
|||
byte[] inflatedBuffer = m_StairBuffers[i];
|
||||
|
||||
int deflatedLength = m_DeflatedBuffer.Length;
|
||||
ZLibError ce = ZLib.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
|
||||
ZLibQuality.Default);
|
||||
ZlibError ce = Zlib.Pack(m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size,
|
||||
ZlibQuality.Default);
|
||||
|
||||
if (ce != ZLibError.Okay)
|
||||
if (ce != ZlibError.Okay)
|
||||
{
|
||||
Console.WriteLine("ZLib error: {0} (#{1})", ce, (int)ce);
|
||||
deflatedLength = 0;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.5" />
|
||||
<!-- Direct packages -->
|
||||
<PackageReference Include="MailKit" Version="2.7.0" />
|
||||
<PackageReference Include="Zlib.Bindings" Version="1.0.2" />
|
||||
<PackageReference Include="Zlib.Bindings" Version="1.0.3" />
|
||||
<PackageReference Include="Argon2.Bindings" Version="1.3.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Analyze'">
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@
|
|||
"resolved": "3.1.5",
|
||||
"contentHash": "ZvwowjRSWXewdPI+whPFXgwF4Qme6Q9KV9SCPEITSGiqHLArct7q5hTBtTzj3GPsVLjTqehvTg6Bd/EQk9JS0A=="
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -792,7 +792,7 @@
|
|||
"Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv": "3.1.5",
|
||||
"Microsoft.Extensions.Hosting.Abstractions": "3.1.5",
|
||||
"System.IO.Pipelines": "4.7.2",
|
||||
"ZLib.Bindings": "1.0.2"
|
||||
"Zlib.Bindings": "1.0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -803,11 +803,11 @@
|
|||
"resolved": "1.3.0",
|
||||
"contentHash": "cxRZ+nwH33QozaFBAftjctf9PoNEXgcEI5dBHHDkWI24EwCeOXRp0M+h5muavQADfxIvPG9o4FNCSnP7VkV6wQ=="
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -1506,11 +1506,11 @@
|
|||
"resolved": "1.3.0",
|
||||
"contentHash": "cxRZ+nwH33QozaFBAftjctf9PoNEXgcEI5dBHHDkWI24EwCeOXRp0M+h5muavQADfxIvPG9o4FNCSnP7VkV6wQ=="
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -2209,11 +2209,11 @@
|
|||
"resolved": "1.3.0",
|
||||
"contentHash": "cxRZ+nwH33QozaFBAftjctf9PoNEXgcEI5dBHHDkWI24EwCeOXRp0M+h5muavQADfxIvPG9o4FNCSnP7VkV6wQ=="
|
||||
},
|
||||
"ZLib.Bindings": {
|
||||
"Zlib.Bindings": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.2, )",
|
||||
"resolved": "1.0.2",
|
||||
"contentHash": "KlvJLY55UYpwlxbiX+lJbTuaMWBK3mja3BC3GzTlCA3uHRYxsllL9uYqpe4poFe6l8NMBS/k759+ns8pbeXeMg=="
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "zk4N0anMKT8s25NY2Euw+Z5mwlSoh2D1XyYik0NJ2fRrSw96hP7nnu9ii2BRdl0ttdl0oflNZ9cme99JoSavyQ=="
|
||||
},
|
||||
"Libuv": {
|
||||
"type": "Transitive",
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
internal static class RuntimeUtility
|
||||
{
|
||||
internal static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
internal static readonly bool IsDarwin = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
internal static readonly bool IsFreeBSD = RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD);
|
||||
internal static readonly bool IsLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || IsFreeBSD;
|
||||
internal static readonly bool IsUnix = IsDarwin || IsFreeBSD || IsLinux;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Server.Compression
|
||||
{
|
||||
public static class ZLib
|
||||
{
|
||||
public static readonly ICompressor Compressor;
|
||||
|
||||
static ZLib()
|
||||
{
|
||||
if (RuntimeUtility.IsUnix)
|
||||
Compressor = new UnixCompressor();
|
||||
else
|
||||
Compressor = new Compressor();
|
||||
}
|
||||
|
||||
public static int MaxPackSize(int sourceLength) => (int)Compressor.CompressBound((ulong)sourceLength);
|
||||
|
||||
public static unsafe ZLibError Pack(Span<byte> dest, ref int destLength, ReadOnlySpan<byte> source, int sourceLength)
|
||||
{
|
||||
var destLengthLong = (ulong)destLength;
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
var e = Compressor.Compress(Unsafe.AsRef<int>(dPtr), ref destLengthLong, Unsafe.AsRef<int>(sPtr),
|
||||
(ulong)sourceLength);
|
||||
destLength = (int)destLengthLong;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe ZLibError Pack(Span<byte> dest, ref int destLength, ReadOnlySpan<byte> source, ZLibQuality quality)
|
||||
{
|
||||
var destLengthLong = (ulong)destLength;
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
var e = Compressor.Compress(Unsafe.AsRef<int>(dPtr), ref destLengthLong, Unsafe.AsRef<int>(sPtr),
|
||||
(ulong)source.Length, quality);
|
||||
destLength = (int)destLengthLong;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe ZLibError Pack(Span<byte> dest, ref int destLength, ReadOnlySpan<byte> source, int sourceLength,
|
||||
ZLibQuality quality)
|
||||
{
|
||||
var destLengthLong = (ulong)destLength;
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
var e = Compressor.Compress(Unsafe.AsRef<int>(dPtr), ref destLengthLong, Unsafe.AsRef<int>(sPtr),
|
||||
(ulong)sourceLength, quality);
|
||||
destLength = (int)destLengthLong;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe ZLibError Unpack(Span<byte> dest, ref int destLength, ReadOnlySpan<byte> source, int sourceLength)
|
||||
{
|
||||
var destLengthLong = (ulong)destLength;
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
var e = Compressor.Decompress(Unsafe.AsRef<int>(dPtr), ref destLengthLong, Unsafe.AsRef<int>(sPtr),
|
||||
(ulong)sourceLength);
|
||||
destLength = (int)destLengthLong;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static ulong MaxPackSize(ulong sourceLength) => Compressor.CompressBound(sourceLength);
|
||||
|
||||
public static unsafe ZLibError Pack(Span<byte> dest, ref ulong destLength, ReadOnlySpan<byte> source, ulong sourceLength)
|
||||
{
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
return Compressor.Compress(Unsafe.AsRef<int>(dPtr), ref destLength, Unsafe.AsRef<int>(sPtr), sourceLength);
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe ZLibError Pack(Span<byte> dest, ref ulong destLength, ReadOnlySpan<byte> source,
|
||||
ZLibQuality quality)
|
||||
{
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
return Compressor.Compress(Unsafe.AsRef<int>(dPtr), ref destLength, Unsafe.AsRef<int>(sPtr), (ulong)source.Length,
|
||||
quality);
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe ZLibError Pack(Span<byte> dest, ref ulong destLength, ReadOnlySpan<byte> source, ulong sourceLength,
|
||||
ZLibQuality quality)
|
||||
{
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
return Compressor.Compress(Unsafe.AsRef<int>(dPtr), ref destLength, Unsafe.AsRef<int>(sPtr), sourceLength, quality);
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe ZLibError Unpack(Span<byte> dest, ref ulong destLength, ReadOnlySpan<byte> source,
|
||||
ulong sourceLength)
|
||||
{
|
||||
fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source))
|
||||
{
|
||||
return Compressor.Decompress(Unsafe.AsRef<int>(dPtr), ref destLength, Unsafe.AsRef<int>(sPtr), sourceLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICompressor
|
||||
{
|
||||
string Version { get; }
|
||||
ZLibError Compress(in int dest, ref ulong destLength, in int source, ulong sourceLength);
|
||||
ZLibError Compress(in int dest, ref ulong destLength, in int source, ulong sourceLength, ZLibQuality quality);
|
||||
ZLibError Decompress(in int dest, ref ulong destLength, in int source, ulong sourceLength);
|
||||
ulong CompressBound(ulong sourceLength);
|
||||
}
|
||||
|
||||
public class Compressor : ICompressor
|
||||
{
|
||||
public string Version => SafeNativeMethods.zlibVersion();
|
||||
|
||||
public ZLibError Compress(in int dest, ref ulong destLength, in int source, ulong sourceLength) =>
|
||||
SafeNativeMethods.compress(dest, ref destLength, source, sourceLength);
|
||||
|
||||
public ZLibError Compress(in int dest, ref ulong destLength, in int source, ulong sourceLength,
|
||||
ZLibQuality quality) => SafeNativeMethods.compress2(dest, ref destLength, source, sourceLength, quality);
|
||||
|
||||
public ZLibError Decompress(in int dest, ref ulong destLength, in int source, ulong sourceLength) =>
|
||||
SafeNativeMethods.uncompress(dest, ref destLength, source, sourceLength);
|
||||
|
||||
public ulong CompressBound(ulong sourceLength) => SafeNativeMethods.compressBound(sourceLength);
|
||||
|
||||
private static class SafeNativeMethods
|
||||
{
|
||||
[DllImport("zlib", CharSet = CharSet.Unicode)]
|
||||
internal static extern string zlibVersion();
|
||||
|
||||
[DllImport("zlib")]
|
||||
internal static extern ZLibError compress(in int dest, ref ulong destLength, in int source, ulong sourceLength);
|
||||
|
||||
[DllImport("zlib")]
|
||||
internal static extern ZLibError compress2(in int dest, ref ulong destLength, in int source, ulong sourceLength,
|
||||
ZLibQuality quality);
|
||||
|
||||
[DllImport("zlib")]
|
||||
internal static extern ZLibError uncompress(in int dest, ref ulong destLength, in int source, ulong sourceLength);
|
||||
|
||||
[DllImport("zlib")]
|
||||
internal static extern ulong compressBound(ulong sourceLen);
|
||||
}
|
||||
}
|
||||
|
||||
public class UnixCompressor : ICompressor
|
||||
{
|
||||
public string Version => SafeNativeMethods.zlibVersion();
|
||||
|
||||
public ZLibError Compress(in int dest, ref ulong destLength, in int source, ulong sourceLength) =>
|
||||
SafeNativeMethods.compress(dest, ref destLength, source, sourceLength);
|
||||
|
||||
public ZLibError Compress(in int dest, ref ulong destLength, in int source, ulong sourceLength,
|
||||
ZLibQuality quality) => SafeNativeMethods.compress2(dest, ref destLength, source, sourceLength, quality);
|
||||
|
||||
public ZLibError Decompress(in int dest, ref ulong destLength, in int source, ulong sourceLength) =>
|
||||
SafeNativeMethods.uncompress(dest, ref destLength, source, sourceLength);
|
||||
|
||||
public ulong CompressBound(ulong sourceLength) => SafeNativeMethods.compressBound(sourceLength);
|
||||
|
||||
internal static class SafeNativeMethods
|
||||
{
|
||||
[DllImport("libz", CharSet = CharSet.Unicode)]
|
||||
internal static extern string zlibVersion();
|
||||
|
||||
[DllImport("libz")]
|
||||
internal static extern ZLibError compress(in int dest, ref ulong destLength, in int source, ulong sourceLength);
|
||||
|
||||
[DllImport("libz")]
|
||||
internal static extern ZLibError compress2(in int dest, ref ulong destLength, in int source, ulong sourceLength,
|
||||
ZLibQuality quality);
|
||||
|
||||
[DllImport("libz")]
|
||||
internal static extern ZLibError uncompress(in int dest, ref ulong destLength, in int source, ulong sourceLength);
|
||||
|
||||
[DllImport("libz")]
|
||||
internal static extern ulong compressBound(ulong sourceLen);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ZLibError
|
||||
{
|
||||
VersionError = -6,
|
||||
BufferError = -5,
|
||||
MemoryError = -4,
|
||||
DataError = -3,
|
||||
StreamError = -2,
|
||||
FileError = -1,
|
||||
Okay = 0,
|
||||
StreamEnd = 1,
|
||||
NeedDictionary = 2
|
||||
}
|
||||
|
||||
public enum ZLibQuality
|
||||
{
|
||||
Default = -1,
|
||||
None = 0,
|
||||
Speed = 1,
|
||||
Size = 9
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageVersion>1.0.2</PackageVersion>
|
||||
<RootNamespace>Server</RootNamespace>
|
||||
<AssemblyName>ZLib.Bindings</AssemblyName>
|
||||
<IsPackable>true</IsPackable>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<Configurations>Debug;Release;Analyze</Configurations>
|
||||
<AssemblyVersion>1.0.2</AssemblyVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="runtimes\win-x64\native\zlib.dll">
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>runtimes/win-x64/native</PackagePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="runtimes\osx-x64\native\libz.dylib">
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>runtimes/osx-x64/native</PackagePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="runtimes\linux-x64\native\libz.so">
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>runtimes/linux-x64/native</PackagePath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
".NETCoreApp,Version=v3.1": {},
|
||||
".NETCoreApp,Version=v3.1/linux-x64": {},
|
||||
".NETCoreApp,Version=v3.1/osx-x64": {},
|
||||
".NETCoreApp,Version=v3.1/win-x64": {}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,29 +0,0 @@
|
|||
:<<"::SHELLSCRIPT"
|
||||
@ECHO OFF
|
||||
GOTO :CMDSCRIPT
|
||||
|
||||
::SHELLSCRIPT
|
||||
if [[ -z $2 ]]
|
||||
then
|
||||
c="-c Release"
|
||||
else
|
||||
c="-c $2"
|
||||
fi
|
||||
|
||||
dotnet build ${c} Projects/Argon2/Argon2.csproj
|
||||
dotnet pack ${c} -o packages Projects/Argon2/Argon2.csproj
|
||||
dotnet build ${c} Projects/ZLib/ZLib.csproj
|
||||
dotnet pack ${c} -o packages Projects/ZLib/ZLib.csproj
|
||||
exit $?
|
||||
|
||||
:CMDSCRIPT
|
||||
IF "%~1" == "" (
|
||||
SET c=-c Release
|
||||
) ELSE (
|
||||
SET c=-c %~1
|
||||
)
|
||||
|
||||
dotnet build %c% Projects\Argon2\Argon2.csproj
|
||||
dotnet pack %c% -o packages Projects\Argon2\Argon2.csproj
|
||||
dotnet build %c% Projects\ZLib\ZLib.csproj
|
||||
dotnet pack %c% -o packages Projects\ZLib\ZLib.csproj
|
||||
|
|
@ -1 +0,0 @@
|
|||
Tools/build-native-libraries.cmd "$@"
|
||||
|
|
@ -10,7 +10,6 @@ else
|
|||
c="-c $2"
|
||||
fi
|
||||
|
||||
Tools/build-native-libraries.cmd $2
|
||||
dotnet restore --force-evaluate
|
||||
|
||||
if [[ $1 ]]
|
||||
|
|
@ -36,7 +35,6 @@ IF "%~2" == "" (
|
|||
SET c=-c %~2
|
||||
)
|
||||
|
||||
CALL Tools\build-native-libraries.cmd %~2
|
||||
dotnet restore --force-evaluate
|
||||
|
||||
IF "%~1" == "" (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue