diff --git a/LZ/Decompressor.cs b/LZ/Decompressor.cs index a256ef0..1d7759a 100644 --- a/LZ/Decompressor.cs +++ b/LZ/Decompressor.cs @@ -91,7 +91,7 @@ namespace SabreTools.Compression.LZ string inputExtension = Path.GetExtension(input).TrimStart('.'); // If we have no extension - if (string.IsNullOrWhiteSpace(inputExtension)) + if (string.IsNullOrEmpty(inputExtension)) return Path.GetFileNameWithoutExtension(input); // If we have an extension of length 1 @@ -552,6 +552,6 @@ namespace SabreTools.Compression.LZ return fileHeader; } - #endregion +#endregion } } \ No newline at end of file diff --git a/OldDotNet.cs b/OldDotNet.cs new file mode 100644 index 0000000..65831ad --- /dev/null +++ b/OldDotNet.cs @@ -0,0 +1,50 @@ +#if NET20 || NET35 + +using System; +using System.IO; + +namespace SabreTools.Compression +{ + /// + /// Derived from the mscorlib code from .NET Framework 4.0 + /// + internal static class OldDotNet + { + public static void CopyTo(this Stream source, Stream destination) + { + if (destination == null) + { + throw new ArgumentNullException("destination"); + } + + if (!source.CanRead && !source.CanWrite) + { + throw new ObjectDisposedException(null); + } + + if (!destination.CanRead && !destination.CanWrite) + { + throw new ObjectDisposedException("destination"); + } + + if (!source.CanRead) + { + throw new NotSupportedException(); + } + + if (!destination.CanWrite) + { + throw new NotSupportedException(); + } + + byte[] array = new byte[81920]; + int count; + while ((count = source.Read(array, 0, array.Length)) != 0) + { + destination.Write(array, 0, count); + } + } + } +} + +#endif \ No newline at end of file diff --git a/SabreTools.Compression.csproj b/SabreTools.Compression.csproj index 2ea2ca2..5e94b3e 100644 --- a/SabreTools.Compression.csproj +++ b/SabreTools.Compression.csproj @@ -2,7 +2,7 @@ - net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 + net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 true latest