diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 6ed6e0b63..38a88fe67 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -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 diff --git a/ModernUO.sln b/ModernUO.sln index 63e8144f5..c469a81f0 100644 --- a/ModernUO.sln +++ b/ModernUO.sln @@ -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 diff --git a/NuGet.Config b/NuGet.Config deleted file mode 100644 index 43de52fb5..000000000 --- a/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Projects/Server.Tests/packages.lock.json b/Projects/Server.Tests/packages.lock.json index 7e772b14b..3720761f1 100644 --- a/Projects/Server.Tests/packages.lock.json +++ b/Projects/Server.Tests/packages.lock.json @@ -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==" } } } diff --git a/Projects/Server/MultiData.cs b/Projects/Server/MultiData.cs index c8f46ba9b..5d4eafe2e 100644 --- a/Projects/Server/MultiData.cs +++ b/Projects/Server/MultiData.cs @@ -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 { diff --git a/Projects/Server/Network/Packets/Old Packets/GumpPackets.cs b/Projects/Server/Network/Packets/Old Packets/GumpPackets.cs index b2920c9ed..dfff3af54 100644 --- a/Projects/Server/Network/Packets/Old Packets/GumpPackets.cs +++ b/Projects/Server/Network/Packets/Old Packets/GumpPackets.cs @@ -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); diff --git a/Projects/Server/Server.csproj b/Projects/Server/Server.csproj index 904dd3ec6..3e6fd3f52 100644 --- a/Projects/Server/Server.csproj +++ b/Projects/Server/Server.csproj @@ -69,7 +69,7 @@ - + diff --git a/Projects/Server/packages.lock.json b/Projects/Server/packages.lock.json index 437f618b4..a3bf0d4ef 100644 --- a/Projects/Server/packages.lock.json +++ b/Projects/Server/packages.lock.json @@ -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", diff --git a/Projects/UOContent.Tests/packages.lock.json b/Projects/UOContent.Tests/packages.lock.json index 412f5c164..934984733 100644 --- a/Projects/UOContent.Tests/packages.lock.json +++ b/Projects/UOContent.Tests/packages.lock.json @@ -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==" } } } diff --git a/Projects/UOContent/Multis/HouseFoundation.cs b/Projects/UOContent/Multis/HouseFoundation.cs index c171362b0..028a7792d 100644 --- a/Projects/UOContent/Multis/HouseFoundation.cs +++ b/Projects/UOContent/Multis/HouseFoundation.cs @@ -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; diff --git a/Projects/UOContent/UOContent.csproj b/Projects/UOContent/UOContent.csproj index 3bcd8e3b5..b7eed3c0c 100644 --- a/Projects/UOContent/UOContent.csproj +++ b/Projects/UOContent/UOContent.csproj @@ -68,7 +68,7 @@ - + diff --git a/Projects/UOContent/packages.lock.json b/Projects/UOContent/packages.lock.json index bdc0444c5..fdf8cb281 100644 --- a/Projects/UOContent/packages.lock.json +++ b/Projects/UOContent/packages.lock.json @@ -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", diff --git a/Projects/ZLib/Utility.cs b/Projects/ZLib/Utility.cs deleted file mode 100644 index b450eb6da..000000000 --- a/Projects/ZLib/Utility.cs +++ /dev/null @@ -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; - } -} diff --git a/Projects/ZLib/ZLib.cs b/Projects/ZLib/ZLib.cs deleted file mode 100644 index b8520d8ea..000000000 --- a/Projects/ZLib/ZLib.cs +++ /dev/null @@ -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 dest, ref int destLength, ReadOnlySpan source, int sourceLength) - { - var destLengthLong = (ulong)destLength; - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - var e = Compressor.Compress(Unsafe.AsRef(dPtr), ref destLengthLong, Unsafe.AsRef(sPtr), - (ulong)sourceLength); - destLength = (int)destLengthLong; - return e; - } - } - - public static unsafe ZLibError Pack(Span dest, ref int destLength, ReadOnlySpan source, ZLibQuality quality) - { - var destLengthLong = (ulong)destLength; - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - var e = Compressor.Compress(Unsafe.AsRef(dPtr), ref destLengthLong, Unsafe.AsRef(sPtr), - (ulong)source.Length, quality); - destLength = (int)destLengthLong; - return e; - } - } - - public static unsafe ZLibError Pack(Span dest, ref int destLength, ReadOnlySpan 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(dPtr), ref destLengthLong, Unsafe.AsRef(sPtr), - (ulong)sourceLength, quality); - destLength = (int)destLengthLong; - return e; - } - } - - public static unsafe ZLibError Unpack(Span dest, ref int destLength, ReadOnlySpan source, int sourceLength) - { - var destLengthLong = (ulong)destLength; - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - var e = Compressor.Decompress(Unsafe.AsRef(dPtr), ref destLengthLong, Unsafe.AsRef(sPtr), - (ulong)sourceLength); - destLength = (int)destLengthLong; - return e; - } - } - - public static ulong MaxPackSize(ulong sourceLength) => Compressor.CompressBound(sourceLength); - - public static unsafe ZLibError Pack(Span dest, ref ulong destLength, ReadOnlySpan source, ulong sourceLength) - { - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - return Compressor.Compress(Unsafe.AsRef(dPtr), ref destLength, Unsafe.AsRef(sPtr), sourceLength); - } - } - - public static unsafe ZLibError Pack(Span dest, ref ulong destLength, ReadOnlySpan source, - ZLibQuality quality) - { - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - return Compressor.Compress(Unsafe.AsRef(dPtr), ref destLength, Unsafe.AsRef(sPtr), (ulong)source.Length, - quality); - } - } - - public static unsafe ZLibError Pack(Span dest, ref ulong destLength, ReadOnlySpan source, ulong sourceLength, - ZLibQuality quality) - { - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - return Compressor.Compress(Unsafe.AsRef(dPtr), ref destLength, Unsafe.AsRef(sPtr), sourceLength, quality); - } - } - - public static unsafe ZLibError Unpack(Span dest, ref ulong destLength, ReadOnlySpan source, - ulong sourceLength) - { - fixed (byte* dPtr = &MemoryMarshal.GetReference(dest), sPtr = &MemoryMarshal.GetReference(source)) - { - return Compressor.Decompress(Unsafe.AsRef(dPtr), ref destLength, Unsafe.AsRef(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 - } -} diff --git a/Projects/ZLib/ZLib.csproj b/Projects/ZLib/ZLib.csproj deleted file mode 100644 index 43a17c771..000000000 --- a/Projects/ZLib/ZLib.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - 1.0.2 - Server - ZLib.Bindings - true - false - true - Debug;Release;Analyze - 1.0.2 - true - - - - true - runtimes/win-x64/native - PreserveNewest - - - true - runtimes/osx-x64/native - PreserveNewest - - - true - runtimes/linux-x64/native - PreserveNewest - - - diff --git a/Projects/ZLib/packages.lock.json b/Projects/ZLib/packages.lock.json deleted file mode 100644 index 9c9abd993..000000000 --- a/Projects/ZLib/packages.lock.json +++ /dev/null @@ -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": {} - } -} \ No newline at end of file diff --git a/Projects/ZLib/runtimes/linux-x64/native/libz.so b/Projects/ZLib/runtimes/linux-x64/native/libz.so deleted file mode 100755 index 52e459724..000000000 Binary files a/Projects/ZLib/runtimes/linux-x64/native/libz.so and /dev/null differ diff --git a/Projects/ZLib/runtimes/osx-x64/native/libz.dylib b/Projects/ZLib/runtimes/osx-x64/native/libz.dylib deleted file mode 100755 index 385ea372a..000000000 Binary files a/Projects/ZLib/runtimes/osx-x64/native/libz.dylib and /dev/null differ diff --git a/Projects/ZLib/runtimes/win-x64/native/zlib.dll b/Projects/ZLib/runtimes/win-x64/native/zlib.dll deleted file mode 100644 index f06c9eb87..000000000 Binary files a/Projects/ZLib/runtimes/win-x64/native/zlib.dll and /dev/null differ diff --git a/Tools/build-native-libraries.cmd b/Tools/build-native-libraries.cmd deleted file mode 100755 index 8423b9ae9..000000000 --- a/Tools/build-native-libraries.cmd +++ /dev/null @@ -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 diff --git a/Tools/build-native-libraries.sh b/Tools/build-native-libraries.sh deleted file mode 100755 index 1b577bc6c..000000000 --- a/Tools/build-native-libraries.sh +++ /dev/null @@ -1 +0,0 @@ -Tools/build-native-libraries.cmd "$@" diff --git a/Tools/publish.cmd b/Tools/publish.cmd index d070536f7..57e077785 100755 --- a/Tools/publish.cmd +++ b/Tools/publish.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" == "" ( diff --git a/packages/do_not_delete b/packages/do_not_delete deleted file mode 100644 index e69de29bb..000000000