mirror of
https://github.com/SabreTools/SabreTools.Compression.git
synced 2026-02-06 13:47:31 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daf27b9175 | ||
|
|
daaf157bc5 | ||
|
|
163b2483f9 | ||
|
|
8ed85d52ed | ||
|
|
042fc18aa7 |
4
.github/workflows/build_nupkg.yml
vendored
4
.github/workflows/build_nupkg.yml
vendored
@@ -28,13 +28,13 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 'Nuget Package'
|
||||
path: 'bin/Release/*.nupkg'
|
||||
path: 'SabreTools.Compression/bin/Release/*.nupkg'
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: 'bin/Release/*.nupkg'
|
||||
artifacts: 'SabreTools.Compression/bin/Release/*.nupkg'
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static SabreTools.Compression.Blast.Constants;
|
||||
|
||||
namespace SabreTools.Compression.Blast
|
||||
@@ -148,7 +147,9 @@ namespace SabreTools.Compression.Blast
|
||||
{
|
||||
try
|
||||
{
|
||||
OutHow.AddRange(Output.Take((int)Next));
|
||||
byte[] next = new byte[Next];
|
||||
Array.Copy(Output, next, next.Length);
|
||||
OutHow.AddRange(next);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
|
||||
9
SabreTools.Compression/ExtensionAttribute.cs
Normal file
9
SabreTools.Compression/ExtensionAttribute.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
#if NET20
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
|
||||
internal sealed class ExtensionAttribute : Attribute {}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Models.Compression.LZ;
|
||||
@@ -181,7 +181,8 @@ namespace SabreTools.Compression.LZ
|
||||
}
|
||||
|
||||
// Initialize the table with all spaces
|
||||
byte[] table = Enumerable.Repeat((byte)' ', LZ_TABLE_SIZE).ToArray();
|
||||
byte[] table = new byte[LZ_TABLE_SIZE];
|
||||
table = Array.ConvertAll(table, b => (byte)' ');
|
||||
|
||||
// Build the state
|
||||
var state = new State
|
||||
@@ -247,7 +248,8 @@ namespace SabreTools.Compression.LZ
|
||||
state.RealCurrent = 0;
|
||||
state.ByteType = 0;
|
||||
state.StringLength = 0;
|
||||
state.Table = Enumerable.Repeat((byte)' ', LZ_TABLE_SIZE).ToArray();
|
||||
state.Table = new byte[LZ_TABLE_SIZE];
|
||||
state.Table = Array.ConvertAll(state.Table, b => (byte)' ');
|
||||
state.CurrentTableEntry = 0xFF0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SabreTools.IO.Streams;
|
||||
using SabreTools.Models.Compression.MSZIP;
|
||||
using static SabreTools.Models.Compression.MSZIP.Constants;
|
||||
@@ -316,13 +315,15 @@ namespace SabreTools.Compression.MSZIP
|
||||
if (distance == null)
|
||||
return null;
|
||||
|
||||
byte[] arr = bytes.Skip(bytes.Count - (int)distance).Take((int)length).ToArray();
|
||||
byte[] bytesArr = [.. bytes];
|
||||
byte[] arr = new byte[(int)length];
|
||||
Array.Copy(bytesArr, bytes.Count - (int)distance, arr, 0, (int)length);
|
||||
bytes.AddRange(arr);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the decoded array
|
||||
return bytes.ToArray();
|
||||
return [.. bytes];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
using System.Linq;
|
||||
#endif
|
||||
using SabreTools.IO.Streams;
|
||||
|
||||
namespace SabreTools.Compression.MSZIP
|
||||
@@ -27,7 +29,15 @@ namespace SabreTools.Compression.MSZIP
|
||||
HuffmanNode? root = null;
|
||||
|
||||
// Determine the value for max_bits
|
||||
#if NET20
|
||||
uint max_bits = 0;
|
||||
foreach (uint u in lengths)
|
||||
{
|
||||
max_bits = u > max_bits ? u : max_bits;
|
||||
}
|
||||
#else
|
||||
uint max_bits = lengths.Max();
|
||||
#endif
|
||||
|
||||
// Count the number of codes for each code length
|
||||
int[] bl_count = new int[max_bits + 1];
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>0.6.0</Version>
|
||||
<Version>0.6.1</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
@@ -21,27 +21,13 @@
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Support All Frameworks -->
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net4`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`netcoreapp`)) OR $(TargetFramework.StartsWith(`net5`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith(`net6`)) OR $(TargetFramework.StartsWith(`net7`)) OR $(TargetFramework.StartsWith(`net8`)) OR $(TargetFramework.StartsWith(`net9`))">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="../README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.5.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.0" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.5.1" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user