diff --git a/SharpCompress.sln b/SharpCompress.sln index e82ccc1a6..a94d81099 100644 --- a/SharpCompress.sln +++ b/SharpCompress.sln @@ -1,20 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F18F1765-4A02-42FD-9BEF-F0E2FCBD9D17}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SharpCompress", "src\SharpCompress\SharpCompress.xproj", "{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C5BE746-03E5-4895-9988-0B57F162F86C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0F0901FF-E8D9-426A-B5A2-17C7F47C1529}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SharpCompress.Test", "test\SharpCompress.Test\SharpCompress.Test.xproj", "{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCompress", "src\SharpCompress\SharpCompress.csproj", "{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCompress.Test", "test\SharpCompress.Test\SharpCompress.Test.csproj", "{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}" ProjectSection(ProjectDependencies) = postProject {FD19DDD8-72B2-4024-8665-0D1F7A2AA998} = {FD19DDD8-72B2-4024-8665-0D1F7A2AA998} EndProjectSection diff --git a/appveyor.yml b/appveyor.yml index 058121f11..7771ef554 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,17 +1,30 @@ -version: '0.15.{build}' +version: '{build}' +image: Visual Studio 2017 -init: -- git config --global core.autocrlf true +pull_requests: + do_not_increment_build_number: true -build_script: -- ps: .\build.ps1 +branches: + only: + - master -test: off +nuget: + disable_publish_on_pr: true -cache: -- tools -> build.cake -- tools -> build.ps1 +before_build: + - cmd: dotnet restore + +after_build: +- dotnet pack "src\SharpCompress\SharpCompress.csproj" -c Release + +test_script: +- dotnet test "test\SharpCompress" -c Release artifacts: -- path: nupkgs\*.nupkg - name: NuPkgs \ No newline at end of file +- path: src\SharpCompress\bin\Release\*.nupkg + +deploy: + - provider: Environment + name: nuget.org + on: + branch: master \ No newline at end of file diff --git a/build.cake b/build.cake deleted file mode 100644 index 0977c35ac..000000000 --- a/build.cake +++ /dev/null @@ -1,229 +0,0 @@ -#addin "Cake.Json" - -#addin "nuget:?package=NuGet.Core" - -using NuGet; - - -////////////////////////////////////////////////////////////////////// -// ARGUMENTS -////////////////////////////////////////////////////////////////////// - -var target = Argument("target", "Default"); -var apiKey = Argument("apiKey", ""); -var repo = Argument("repo", ""); - -////////////////////////////////////////////////////////////////////// -// PREPARATION -////////////////////////////////////////////////////////////////////// - -var sources = new [] { "https://api.nuget.org/v3/index.json" }; -var publishTarget = ""; - -Warning("============="); -var globalPath = MakeFullPath("global.json"); -var nupkgs = MakeFullPath("nupkgs"); -Warning("Operating on global.json: " + globalPath); -Warning("============="); - -////////////////////////////////////////////////////////////////////// -// FUNCTIONS -////////////////////////////////////////////////////////////////////// - -string MakeFullPath(string relativePath) -{ - if (string.IsNullOrEmpty(repo)) - { - return MakeAbsolute(new DirectoryPath(relativePath)).ToString(); - } - if (!System.IO.Path.IsPathRooted(repo)) - { - return MakeAbsolute(new DirectoryPath(System.IO.Path.Combine(repo,relativePath))).ToString(); - } - return System.IO.Path.Combine(repo, relativePath); -} - -IEnumerable GetAllProjects() -{ - var global = DeserializeJsonFromFile(globalPath); - var projs = global["projects"].Select(x => x.ToString()); - foreach(var y in projs) - { - yield return MakeFullPath(y); - } -} - -IEnumerable GetSourceProjects() -{ - return GetAllProjects().Where(x => x.EndsWith("src")); -} - -IEnumerable GetTestProjects() -{ - return GetAllProjects().Where(x => x.EndsWith("test")); -} - -IEnumerable GetFrameworks(string path) -{ - var projectJObject = DeserializeJsonFromFile(path); - foreach(var prop in ((JObject)projectJObject["frameworks"]).Properties()) - { - yield return prop.Name; - } -} - -string GetVersion(string path) -{ - var projectJObject = DeserializeJsonFromFile(path); - return ((JToken)projectJObject["version"]).ToString(); -} - -IEnumerable GetProjectJsons(IEnumerable projects) -{ - foreach(var proj in projects) - { - foreach(var projectJson in GetFiles(proj + "/**/project.json")) - { - yield return MakeFullPath(projectJson.ToString()); - } - } -} - -bool IsNuGetPublished (FilePath file, string nugetSource) -{ - var pkg = new ZipPackage(file.ToString()); - - var repo = PackageRepositoryFactory.Default.CreateRepository(nugetSource); - - var packages = repo.FindPackagesById(pkg.Id); - - var version = SemanticVersion.Parse(pkg.Version.ToString()); - - //Filter the list of packages that are not Release (Stable) versions - var exists = packages.Any (p => p.Version == version); - - return exists; -} - -////////////////////////////////////////////////////////////////////// -// TASKS -////////////////////////////////////////////////////////////////////// - -Task("Restore") - .Does(() => -{ - var settings = new DotNetCoreRestoreSettings - { - Sources = sources, - NoCache = true - }; - - foreach(var project in GetProjectJsons(GetSourceProjects().Concat(GetTestProjects()))) - { - DotNetCoreRestore(project, settings); - } -}); - -Task("Build") - .Does(() => -{ - var settings = new DotNetCoreBuildSettings - { - Configuration = "Release" - }; - - foreach(var project in GetProjectJsons(GetSourceProjects().Concat(GetTestProjects()))) - { - foreach(var framework in GetFrameworks(project)) - { - Information("Building: {0} on Framework: {1}", project, framework); - Information("========"); - settings.Framework = framework; - DotNetCoreBuild(project, settings); - } - } -}); - -Task("Test") - .Does(() => -{ - var settings = new DotNetCoreTestSettings - { - Configuration = "Release", - Verbose = true - }; - - foreach(var project in GetProjectJsons(GetTestProjects())) - { - settings.Framework = GetFrameworks(project).First(); - DotNetCoreTest(project.ToString(), settings); - } - -}).ReportError(exception => -{ - Error(exception.ToString()); -}); - -Task("Pack") - .Does(() => -{ - if (DirectoryExists(nupkgs)) - { - DeleteDirectory(nupkgs, true); - } - CreateDirectory(nupkgs); - - var settings = new DotNetCorePackSettings - { - Configuration = "Release", - OutputDirectory = nupkgs - }; - - foreach(var project in GetProjectJsons(GetSourceProjects())) - { - DotNetCorePack(project, settings); - } -}); - -Task("Publish") - .IsDependentOn("Restore") - .IsDependentOn("Build") - .IsDependentOn("Test") - .IsDependentOn("Pack") - .Does(() => -{ - var packages = GetFiles(nupkgs + "/*.nupkg"); - foreach(var package in packages) - { - if (package.ToString().Contains("symbols")) - { - Warning("Skipping Symbols package " + package); - continue; - } - if (IsNuGetPublished(package, sources[1])) - { - throw new InvalidOperationException(package + " is already published."); - } - NuGetPush(package, new NuGetPushSettings{ - ApiKey = apiKey, - Verbosity = NuGetVerbosity.Detailed, - Source = publishTarget - }); - } -}); - -////////////////////////////////////////////////////////////////////// -// TASK TARGETS -////////////////////////////////////////////////////////////////////// - -Task("Default") - .IsDependentOn("Restore") - .IsDependentOn("Build") - .IsDependentOn("Test") - .IsDependentOn("Pack"); - -////////////////////////////////////////////////////////////////////// -// EXECUTION -////////////////////////////////////////////////////////////////////// - -RunTarget(target); \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 878a2dc4d..000000000 --- a/build.ps1 +++ /dev/null @@ -1,130 +0,0 @@ -<# -.SYNOPSIS -This is a Powershell script to bootstrap a Cake build. -.DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) -and execute your Cake build script with the parameters you provide. -.PARAMETER Target -The build script target to run. -.PARAMETER Configuration -The build configuration to use. -.PARAMETER Verbosity -Specifies the amount of information to be displayed. -.PARAMETER WhatIf -Performs a dry run of the build script. -No tasks will be executed. -.PARAMETER ScriptArgs -Remaining arguments are added here. -.LINK -http://cakebuild.net -#> - -[CmdletBinding()] -Param( - [string]$Script = "build.cake", - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$WhatIf, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -$CakeVersion = "0.16.1" -$DotNetChannel = "preview"; -$DotNetVersion = "1.0.0-preview2-003131"; -$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1"; -$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" - -# Make sure tools folder exists -$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent -$ToolPath = Join-Path $PSScriptRoot "tools" -if (!(Test-Path $ToolPath)) { - Write-Verbose "Creating tools directory..." - New-Item -Path $ToolPath -Type directory | out-null -} - -########################################################################### -# INSTALL .NET CORE CLI -########################################################################### - -Function Remove-PathVariable([string]$VariableToRemove) -{ - $path = [Environment]::GetEnvironmentVariable("PATH", "User") - if ($path -ne $null) - { - $newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User") - } - - $path = [Environment]::GetEnvironmentVariable("PATH", "Process") - if ($path -ne $null) - { - $newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process") - } -} - -# Get .NET Core CLI path if installed. -$FoundDotNetCliVersion = $null; -if (Get-Command dotnet -ErrorAction SilentlyContinue) { - $FoundDotNetCliVersion = dotnet --version; -} - -if($FoundDotNetCliVersion -ne $DotNetVersion) { - $InstallPath = Join-Path $PSScriptRoot ".dotnet" - if (!(Test-Path $InstallPath)) { - mkdir -Force $InstallPath | Out-Null; - } - (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); - & $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; - - Remove-PathVariable "$InstallPath" - $env:PATH = "$InstallPath;$env:PATH" - $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 -} - -########################################################################### -# INSTALL NUGET -########################################################################### - -# Make sure nuget.exe exists. -$NugetPath = Join-Path $ToolPath "nuget.exe" -if (!(Test-Path $NugetPath)) { - Write-Host "Downloading NuGet.exe..." - (New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath); -} - -########################################################################### -# INSTALL CAKE -########################################################################### - -# Make sure Cake has been installed. -$CakePath = Join-Path $ToolPath "Cake.$CakeVersion/Cake.exe" -if (!(Test-Path $CakePath)) { - Write-Host "Installing Cake..." - Invoke-Expression "&`"$NugetPath`" install Cake -Version $CakeVersion -OutputDirectory `"$ToolPath`"" | Out-Null; - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring Cake from NuGet." - } -} - -########################################################################### -# RUN BUILD SCRIPT -########################################################################### - -# Build the argument list. -$Arguments = @{ - target=$Target; - configuration=$Configuration; - verbosity=$Verbosity; - dryrun=$WhatIf; -}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value }; - -# Start Cake -Write-Host "Running build script..." -Invoke-Expression "& `"$CakePath`" `"$Script`" $Arguments $ScriptArgs" -exit $LASTEXITCODE \ No newline at end of file diff --git a/global.json b/global.json deleted file mode 100644 index d0f936b56..000000000 --- a/global.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "projects": ["src","test"] -} diff --git a/src/SharpCompress/Readers/AbstractReader.cs b/src/SharpCompress/Readers/AbstractReader.cs index af0cbdeb5..fd513d267 100644 --- a/src/SharpCompress/Readers/AbstractReader.cs +++ b/src/SharpCompress/Readers/AbstractReader.cs @@ -16,9 +16,7 @@ public abstract class AbstractReader : IReader, IReaderExtracti private bool completed; private IEnumerator entriesForCurrentReadStream; private bool wroteCurrentEntry; - - public event EventHandler> EntryExtractionBegin; - public event EventHandler> EntryExtractionEnd; + public event EventHandler> EntryExtractionProgress; public event EventHandler CompressedBytesRead; diff --git a/src/SharpCompress/SharpCompress.csproj b/src/SharpCompress/SharpCompress.csproj new file mode 100644 index 000000000..8c7be75d2 --- /dev/null +++ b/src/SharpCompress/SharpCompress.csproj @@ -0,0 +1,31 @@ + + + + SharpCompress - Pure C# Decompression/Compression + en-US + 0.15.2 + Adam Hathcock + net35;netstandard1.0;netstandard1.3 + true + true + SharpCompress + ../../SharpCompress.snk + true + true + SharpCompress + rar;unrar;zip;unzip;bzip2;gzip;tar;7zip + https://github.com/adamhathcock/sharpcompress + https://github.com/adamhathcock/sharpcompress/blob/master/LICENSE.txt + false + false + + + + + + + + $(DefineConstants);NO_FILE;NO_CRYPTO;SILVERLIGHT + + + diff --git a/src/SharpCompress/SharpCompress.xproj b/src/SharpCompress/SharpCompress.xproj deleted file mode 100644 index 269099f55..000000000 --- a/src/SharpCompress/SharpCompress.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - fd19ddd8-72b2-4024-8665-0d1f7a2aa998 - SharpCompress - .\obj - .\bin\ - v4.5.2 - - - 2.0 - - - diff --git a/src/SharpCompress/project.json b/src/SharpCompress/project.json deleted file mode 100644 index 58344cdca..000000000 --- a/src/SharpCompress/project.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "version": "0.15.2", - "title": "SharpCompress - Pure C# Decompression/Compression", - "authors": [ "Adam Hathcock" ], - "language": "en-US", - "packOptions": { - "owners": [ "Adam Hathcock" ], - "tags": [ "rar", "unrar", "zip", "unzip", "bzip2", "gzip", "tar", "7zip" ], - "projectUrl": "https://github.com/adamhathcock/sharpcompress", - "licenseUrl": "https://github.com/adamhathcock/sharpcompress/blob/master/LICENSE.txt", - "description": "SharpCompress is a compression library for .NET/Mono/Silverlight/WP7/WindowsStore that can unrar, decompress 7zip, zip/unzip, tar/untar bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.", - "requireLicenseAcceptance": false - }, - "buildOptions": { - "warningsAsErrors": true, - "allowUnsafe": true, - "keyFile": "../../SharpCompress.snk" - }, - "frameworks": { - "net35": { - }, - "net40": { - }, - "net45": { - }, - ".NETPortable,Version=v4.0,Profile=Profile328": { - "buildOptions": { - "define": [ "NO_FILE", "NO_CRYPTO", "SILVERLIGHT" ] - }, - "frameworkAssemblies": { - "mscorlib": { "type": "build" }, - "System": { "type": "build" }, - "System.Core": { "type": "build" } - } - }, - ".NETPortable,Version=v4.5,Profile=Profile259": { - "buildOptions": { - "define": [ "NO_FILE", "NO_CRYPTO", "SILVERLIGHT" ] - }, - "frameworkAssemblies": { - "System": { "type": "build" }, - "System.Collections": { "type": "build" }, - "System.Core": { "type": "build" }, - "System.Diagnostics.Debug": { "type": "build" }, - "System.IO": { "type": "build" }, - "System.Linq": { "type": "build" }, - "System.Linq.Expressions": { "type": "build" }, - "System.Resources.ResourceManager": { "type": "build" }, - "System.Runtime": { "type": "build" }, - "System.Runtime.Extensions": { "type": "build" }, - "System.Text.Encoding": { "type": "build" } - } - }, - "netstandard1.0": { - "buildOptions": { - "define": [ "NO_FILE", "NO_CRYPTO" ] - }, - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding.Extensions": "4.0.11" - } - }, - "netstandard1.3": { - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime.Extensions": "4.1.0", - "System.Security.Cryptography.Algorithms": "4.2.0", - "System.Text.Encoding.Extensions": "4.0.11" - } - } - } -} diff --git a/test/SharpCompress.Test/SharpCompress.Test.csproj b/test/SharpCompress.Test/SharpCompress.Test.csproj new file mode 100644 index 000000000..fcdcb779e --- /dev/null +++ b/test/SharpCompress.Test/SharpCompress.Test.csproj @@ -0,0 +1,29 @@ + + + + netcoreapp1.0 + SharpCompress.Test + ../../SharpCompress.snk + true + true + SharpCompress.Test + true + 1.0.4 + + + + + + + + + + + + + + + + + + diff --git a/test/SharpCompress.Test/SharpCompress.Test.xproj b/test/SharpCompress.Test/SharpCompress.Test.xproj deleted file mode 100644 index 707a40325..000000000 --- a/test/SharpCompress.Test/SharpCompress.Test.xproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 3b80e585-a2f3-4666-8f69-c7ffda0dd7e5 - SharpCompress.Test - .\obj - .\bin\ - v4.5.2 - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/SharpCompress.Test/project.json b/test/SharpCompress.Test/project.json deleted file mode 100644 index 0315281d0..000000000 --- a/test/SharpCompress.Test/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "buildOptions": { - "keyFile": "../../SharpCompress.snk" - }, - - "testRunner": "xunit", - - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.1" - } - } - } - }, - "dependencies": { - "Microsoft.Extensions.PlatformAbstractions": "1.0.0", - "SharpCompress": { "target" : "project"}, - "xunit": "2.2.0-beta2-build3300", - "dotnet-test-xunit": "2.2.0-preview2-build1029" - } -}