1

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?
Anitha v
  • 41
  • 2
  • 1
    You are setting the library path to file that exists on your desktop, not one on the device. Why do you think that this package supports Xamarin? If your only requirement is to split a filE into chunks, that can be done with normal file I/O methods – Jason Jan 19 '23 at 13:42
  • @Jason Thank you, After we changed the library path into the device (Users/macmini3/Library/Developer/CoreSimulator/Devices/F817ACF1-7F04-4A21-A4F3-1225A0809815/data/Containers/Bundle/Application/9AEE5B7A-8FBC-4B17-89CA-1BAD1496834B/SKM_MOBILE.iOS.app/7z.dll), we got the same exception. We may get a data loss in I/O methods, So our client requests us to use any third-party library that split files into multiple files and clues them back together. Do you have any solution for this issue? or Can you please suggest any .net third-party library (Paid/ Free) that supports Xamarin Forms? – Anitha v Jan 20 '23 at 10:21

0 Answers0