mirror of
https://github.com/SabreTools/SabreTools.Compression.git
synced 2026-07-08 18:06:34 +00:00
Fix build issues from old transient deps
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user