Skip to content

Commit

Permalink
change NuGet package for zip files again
Browse files Browse the repository at this point in the history
  • Loading branch information
cengelha committed Mar 3, 2024
1 parent ba3f7f0 commit 4983606
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 5 deletions.
59 changes: 54 additions & 5 deletions libNOM.test/Common.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using System.Text;

using Aspose.Zip;

using libNOM.io;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using SharpCompress.Archives;
using SharpCompress.Common;

namespace libNOM.test;


Expand Down Expand Up @@ -200,11 +201,59 @@ public void ExtractArchive()

if (!Directory.Exists(template))
{
using var zipArchive = new Archive($"{nameof(Properties.Resources.TESTSUITE_ARCHIVE)}.zip", new ArchiveLoadOptions()
//using SharpCompress.Archives;
//using SharpCompress.Common;
Directory.CreateDirectory(template);
using var zipArchive = ArchiveFactory.Open($"{nameof(Properties.Resources.TESTSUITE_ARCHIVE)}.zip", new()
{
DecryptionPassword = Properties.Resources.TESTSUITE_PASSWORD,
Password = Properties.Resources.TESTSUITE_PASSWORD,
});
zipArchive.ExtractToDirectory(template);
foreach (var entry in zipArchive.Entries)
{
if (entry.IsDirectory)
continue;

entry.WriteToDirectory(template, new ExtractionOptions
{
ExtractFullPath = true,
Overwrite = true,
});
}

//using ICSharpCode.SharpZipLib.Zip;
//using var zipArchive = new ZipFile($"{nameof(Properties.Resources.TESTSUITE_ARCHIVE)}.zip")
//{
// Password = Properties.Resources.TESTSUITE_PASSWORD,
//};
//foreach (ZipEntry entry in zipArchive)
// if (entry.IsFile)
// {
// string outputFile = Path.Combine(template, entry.Name);

// Directory.CreateDirectory(Path.GetDirectoryName(outputFile)!);

// using var input = zipArchive.GetInputStream(entry);
// using var output = File.Create(outputFile);
// var buffer = new byte[4096];
// int bytesRead;
// while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0)
// output.Write(buffer, 0, bytesRead);
// }

//using Aspose.Zip;
//using var zipArchive = new Archive($"{nameof(Properties.Resources.TESTSUITE_ARCHIVE)}.zip", new ArchiveLoadOptions()
//{
// DecryptionPassword = Properties.Resources.TESTSUITE_PASSWORD,
//});
//zipArchive.ExtractToDirectory(template);

//using Ionic.Zip;
//using var zipArchive = new ZipFile($"{nameof(Properties.Resources.TESTSUITE_ARCHIVE)}.zip")
//{
// Encryption = EncryptionAlgorithm.WinZipAes256,
// Password = Properties.Resources.TESTSUITE_PASSWORD,
//};
//zipArchive.ExtractAll(template, ExtractExistingFileAction.DoNotOverwrite);
}
if (!Directory.Exists(working))
{
Expand Down
1 change: 1 addition & 0 deletions libNOM.test/libNOM.test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SharpCompress" Version="0.36.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\libNOM.io\libNOM.io.csproj" />
Expand Down

0 comments on commit 4983606

Please sign in to comment.