Anitha v
Anitha v

Reputation: 75

SevenZipSharp library not working on Xamarin forms

We are working on a Xamarin project that needs to split a large file into smaller files with specified file sizes. we tried to use the SeveZipSharp library by installing the squid-box-sevenzipsharp NuGet package which supports xamarin forms for compressing and decompressing large files. But while we compress the large files, we got an exception: kernel32.dll assembly: type: member:(null) For your reference, this is our code,

            SevenZipCompressor.SetLibraryPath(@"/Users/macmini3/Documents/7z/7z.dll");
            SevenZipCompressor compressor = new SevenZipCompressor();
            compressor.ArchiveFormat = OutArchiveFormat.SevenZip;
            compressor.TempFolderPath = Path.GetTempPath();
            compressor.CompressionMode = CompressionMode.Create;
           // compressor.CompressionLevel = CompressionLevel.Fast;
            //compressor.CompressionMethod = CompressionMethod.Lzma2;
            //compressor.ZipEncryptionMethod = ZipEncryptionMethod.Aes256;
            compressor.VolumeSize = 5000000;
            var assemblyDllPath = compressor.TempFolderPath + "32-7z.dll";
            //var assemblyDllPath = compressor.TempFolderPath + "64-7z.dll";
            File.Copy(dll, assemblyDllPath, overwrite: true);
          //  SevenZipExtractor.SetLibraryPath(dll);

            compressor.CompressDirectory(filename, output);
        }
        catch (Exception ex)
        {
          // throws an exception, Kernel32.dll assembly:<unknown assembly> type:<unknown type> member:(null)
        }

We are using Visual Studio Community 2019 for mac (Version: 8.10.25) and Xamarin Forms (Version: 4.5.0.356)

  1. Can anyone please help us to resolve this issue?
  2. Does the SevenZipSharp library support the Xamarin Forms project?
  3. Can anyone suggest any other thirty-party library (Paid/Free) to split large files into smaller files that support Xamarin Forms?

Upvotes: 1

Views: 121

Answers (0)

Related Questions