Compare commits

..

17 Commits

Author SHA1 Message Date
Adam Hathcock
9196f790a0 Change to circle ci build 2017-12-08 12:01:44 +00:00
Adam Hathcock
ad8b5d61e5 Add netstandard1.3 back 2017-12-08 11:53:00 +00:00
Adam Hathcock
8bdabe2e56 Finish adding netstandard 1.0 back 2017-12-08 11:53:00 +00:00
Adam Hathcock
b54ec1b197 Add back netstandard1.0 2017-12-08 11:51:59 +00:00
Adam Hathcock
bf63b178dd Another casing fix 2017-12-08 11:51:22 +00:00
Adam Hathcock
f93b22745d Fix casing on files 2017-12-08 11:51:22 +00:00
Adam Hathcock
b8887b0b6a try fix file ending test again 2017-12-08 11:50:57 +00:00
Adam Hathcock
145bf029ea fix circle build 2017-12-08 11:50:57 +00:00
Adam Hathcock
e64696176a update cake 2017-12-08 11:50:57 +00:00
Adam Hathcock
77d5ad746c switch to circle 2017-12-08 11:50:57 +00:00
Adam Hathcock
3367a321c2 Remove .NET Core 1 support 2017-12-08 11:50:56 +00:00
Adam Hathcock
bb936170cd try adding dotnet 1 too 2017-12-08 11:50:00 +00:00
Adam Hathcock
d318c58a67 Don't say build as netcoreapp1.0 2017-12-08 11:50:00 +00:00
Adam Hathcock
f6d4270258 update travis 2017-12-08 11:50:00 +00:00
Adam Hathcock
1e511992c2 set tests explicitly to netcore2 2017-12-08 11:50:00 +00:00
Adam Hathcock
7e4bfeb9a4 Update xunit 2017-12-08 11:50:00 +00:00
Adam Hathcock
7bcaaf7deb Add netstandard 2.0 target and netcoreapp2.0 tests 2017-12-08 11:49:29 +00:00
4 changed files with 45 additions and 103 deletions

View File

@@ -54,13 +54,13 @@ Task("Test")
DotNetCoreTest(file.ToString(), settings);
settings = new DotNetCoreTestSettings
{
Configuration = "Release",
Framework = "netcoreapp1.1"
};
settings = new DotNetCoreTestSettings
{
Configuration = "Release",
Framework = "netcoreapp2.0"
};
DotNetCoreTest(file.ToString(), settings);
DotNetCoreTest(file.ToString(), settings);
}
});

View File

@@ -2,9 +2,9 @@
<PropertyGroup>
<AssemblyTitle>SharpCompress - Pure C# Decompression/Compression</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>0.19.0</VersionPrefix>
<AssemblyVersion>0.19.0.0</AssemblyVersion>
<FileVersion>0.19.0.0</FileVersion>
<VersionPrefix>0.18.2</VersionPrefix>
<AssemblyVersion>0.18.2.0</AssemblyVersion>
<FileVersion>0.18.2.0</FileVersion>
<Authors>Adam Hathcock</Authors>
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">net45;net35;netstandard1.0;netstandard1.3;netstandard2.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -24,19 +24,4 @@
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.0' ">
<DefineConstants>$(DefineConstants);NO_FILE;NO_CRYPTO;SILVERLIGHT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Buffers" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Buffers" Version="4.4.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<PackageReference Include="System.Buffers" Version="4.4.0" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,4 @@
using System;
#if NETCORE || NET45
using System.Buffers;
#endif
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -10,7 +7,7 @@ using SharpCompress.Readers;
namespace SharpCompress
{
internal static class Utility
{
{
public static ReadOnlyCollection<T> ToReadOnly<T>(this IEnumerable<T> items)
{
return new ReadOnlyCollection<T>(items.ToList());
@@ -142,54 +139,36 @@ namespace SharpCompress
public static void Skip(this Stream source, long advanceAmount)
{
byte[] buffer = GetTransferByteArray();
try
int read = 0;
int readCount = 0;
do
{
int read = 0;
int readCount = 0;
do
readCount = buffer.Length;
if (readCount > advanceAmount)
{
readCount = buffer.Length;
if (readCount > advanceAmount)
{
readCount = (int)advanceAmount;
}
read = source.Read(buffer, 0, readCount);
if (read <= 0)
{
break;
}
advanceAmount -= read;
if (advanceAmount == 0)
{
break;
}
readCount = (int)advanceAmount;
}
read = source.Read(buffer, 0, readCount);
if (read <= 0)
{
break;
}
advanceAmount -= read;
if (advanceAmount == 0)
{
break;
}
while (true);
}
finally
{
#if NETCORE || NET45
ArrayPool<byte>.Shared.Return(buffer);
#endif
}
while (true);
}
public static void Skip(this Stream source)
{
byte[] buffer = GetTransferByteArray();
try
do
{
do
{
}
while (source.Read(buffer, 0, buffer.Length) == buffer.Length);
}
finally
{
#if NETCORE || NET45
ArrayPool<byte>.Shared.Return(buffer);
#endif
}
while (source.Read(buffer, 0, buffer.Length) == buffer.Length);
}
public static DateTime DosDateToDateTime(UInt16 iDate, UInt16 iTime)
@@ -254,48 +233,30 @@ namespace SharpCompress
public static long TransferTo(this Stream source, Stream destination)
{
byte[] array = GetTransferByteArray();
try
int count;
long total = 0;
while (ReadTransferBlock(source, array, out count))
{
int count;
long total = 0;
while (ReadTransferBlock(source, array, out count))
{
total += count;
destination.Write(array, 0, count);
}
return total;
}
finally
{
#if NETCORE || NET45
ArrayPool<byte>.Shared.Return(array);
#endif
total += count;
destination.Write(array, 0, count);
}
return total;
}
public static long TransferTo(this Stream source, Stream destination, Common.Entry entry, IReaderExtractionListener readerExtractionListener)
{
byte[] array = GetTransferByteArray();
try
int count;
var iterations = 0;
long total = 0;
while (ReadTransferBlock(source, array, out count))
{
int count;
var iterations = 0;
long total = 0;
while (ReadTransferBlock(source, array, out count))
{
total += count;
destination.Write(array, 0, count);
iterations++;
readerExtractionListener.FireEntryExtractionProgress(entry, total, iterations);
}
return total;
}
finally
{
#if NETCORE || NET45
ArrayPool<byte>.Shared.Return(array);
#endif
total += count;
destination.Write(array, 0, count);
iterations++;
readerExtractionListener.FireEntryExtractionProgress(entry, total, iterations);
}
return total;
}
private static bool ReadTransferBlock(Stream source, byte[] array, out int count)
@@ -305,11 +266,7 @@ namespace SharpCompress
private static byte[] GetTransferByteArray()
{
#if NETCORE || NET45
return ArrayPool<byte>.Shared.Rent(81920);
#else
return new byte[81920];
#endif
}
public static bool ReadFully(this Stream stream, byte[] buffer)

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<AssemblyName>SharpCompress.Test</AssemblyName>
<AssemblyOriginatorKeyFile>../../SharpCompress.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>