Skip to content

Commit

Permalink
add decompression, release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pofider committed Dec 3, 2019
1 parent 842be3b commit 73fca83
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jsreport.Shared/IReportingBinary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ namespace jsreport.Shared
public interface IReportingBinary
{
Stream ReadContent();
string UniqueId { get; }
string UniqueId { get; }
}
}
17 changes: 16 additions & 1 deletion jsreport.Shared/ReportingBinary.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace jsreport.Shared
{
public class ReportingBinary : IReportingBinary
{
private Func<Stream> _readContent;
private bool _compresed = false;

public ReportingBinary(string uniqueId, Func<Stream> readContent)
{
UniqueId = uniqueId;
_readContent = readContent;
}

public ReportingBinary(string uniqueId, Func<Stream> readContent, bool compressed)
{
UniqueId = uniqueId;
_readContent = readContent;
_compresed = compressed;
}

public Stream ReadContent()
{
if (_compresed)
{
var zip = new ZipArchive(_readContent());
return zip.Entries.First().Open();
}
return _readContent();
}
}

public string UniqueId { get; set; }
}
Expand Down
15 changes: 8 additions & 7 deletions jsreport.Shared/jsreport.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.6;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.0.1</Version>
<Version>2.1.0</Version>
<Authors>Jan Blaha</Authors>
<Company>jsreport</Company>
<Product>jsreport</Product>
<Description>(Internal) Shared helpers for jsreport c# sdk</Description>
<Copyright>Copyright 2013-2017 Jan Blaha</Copyright>
<Copyright>Copyright 2013-2019 Jan Blaha</Copyright>
<PackageLicenseUrl>http://www.opensource.org/licenses/mit-license.php</PackageLicenseUrl>
<PackageProjectUrl>https://jsreport.net</PackageProjectUrl>
<PackageIconUrl>http://jsreport.net/img/favicon.ico</PackageIconUrl>
Expand All @@ -17,8 +17,8 @@
<PackageTags>jsreport</PackageTags>
<PackageReleaseNotes>Release notes are at https://github.com/jsreport/jsreport-dotnet-shared/releases</PackageReleaseNotes>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyVersion>2.0.1.0</AssemblyVersion>
<FileVersion>2.0.1.0</FileVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
</PropertyGroup>

<Choose>
Expand All @@ -29,13 +29,14 @@
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="jsreport.Types" Version="2.2.7" />
<PackageReference Include="jsreport.Types" Version="2.6.1" />
</ItemGroup>
</Otherwise>
</Choose>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
</ItemGroup>

</Project>

0 comments on commit 73fca83

Please sign in to comment.