Code Monkey home page Code Monkey logo

managedxz's Introduction

managedxz's People

Contributors

goldenbull avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

managedxz's Issues

Feature Request: Add netstandard2.1 target

In netstandard 2.1 it is possible to directly read/write from/to .net Steams using Span
For example:
var bytesRead = _stream.Read(new Span<byte>((byte*)_inbuf, BUFSIZE));

This needs the AllowUnsafeBlocks in the project file, but will be as safe as the current Marshal.Copy.

So the package could target both netstandard2.0 and netstandard2.1, and in the netstandard 2.1 version in could use Spans.

perf test

compare the performance of the wrapper and native xz.exe
the wrapper made several memory copies during encode and decode, may hurt the performance

.NET MVC fork

Hi,

It's not a PR because I understand you won't merge this, but take a look at my fork. The difference I made is that the dll's are retrieved from the /bin folder. Your version looked in a temporary folder (where ManagedXZ.dll was stored, but lzma files weren't.)

Thanks for all your effort!

Support for directories.

Hello, so I'm trying to create an compression program that uses XZ format. The other ones I saw used LZMA, which doesn't support multithreading. However, I'm not sure how to make use of this for directories, I only know how to use this for files.
Any help would be appreciated, thanks.

Feature request: Use ArrayPool instead of creating new byte[] every time.

Hi,

Please use System.Buffers.ArrayPool to get a new buffer in the following lines:

var data = new byte[BUFSIZE];

byte[] data = new byte[BUFSIZE];

byte[] data = new byte[BUFSIZE - (uint)_lzma_stream.avail_out];

And maybe in the XZUtils.

They are just temporary buffers, and can be returned in the end of the code block with: ArrayPool<byte>.Shared.Return(data);

Thank you.

Stream.Read may return less than requested bytes

Reading through the source, I noticed the following:
https://github.com/goldenbull/ManagedXZ/blob/master/src/ManagedXZ/XZDecompressStream.cs#L82

Stream.Read may return less than the requested bytes for any number of reasons, not only when it has reached the end of a Stream.

For instance, NetworkStream will return the number of bytes currently available, even if that's less than the number requested. Zero bytes is the only special case, which indicates EndOfStream.

I think you should just check for zero here and send LZMA_FINISH in that case. Otherwise just push through whatever data you got from the Read.

Exception in Native static constructor when PublishSingleFile

Unhandled exception. System.TypeInitializationException: The type initializer for 'ManagedXZ.Native' threw an exception.
---> System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
at System.IO.Path.Combine(String path1, String path2)
at ManagedXZ.Native..cctor()
--- End of inner exception stack trace ---
at ManagedXZ.XZDecompressStream.Init()
at ManagedXZ.XZDecompressStream..ctor(Stream stream)
at AisStreamer.Program.Main(String[] args)

Problem occurs when PublishSingleFile is true (.net core 3+). In this case the executing assembly's location is empty.

Would you accept a PR for fixing this and also fixing my other issue (#8)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.