public LzStream(string path, bool useCreateFile = true) { _handle = useCreateFile ? Compression.LzCreateFile(path, out string uncompressedName) : Compression.LzOpenFile(path, out uncompressedName); UncompressedName = uncompressedName; }
public static unsafe int LzRead(LzHandle handle, byte *buffer, int offset, int count) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } if (offset < 0) { throw new ArgumentOutOfRangeException(nameof(offset)); } if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count)); } return(ValidateLzResult(Imports.LZRead(handle, buffer + offset, count))); }
public static LzHandle LzCreateFile( string path, out string uncompressedName, DesiredAccess access = DesiredAccess.GenericRead, ShareModes share = ShareModes.ReadWrite, CreationDisposition creation = CreationDisposition.OpenExisting) { string name = null; LzHandle handle = null; BufferHelper.BufferInvoke((StringBuffer buffer) => { buffer.EnsureCharCapacity(Paths.MaxPath); int result = ValidateLzResult(Imports.LZCreateFileW(path, access, share, creation, buffer), path); buffer.SetLengthToFirstNull(); name = buffer.ToString(); handle = new LzCreateHandle(result); }); uncompressedName = name; return(handle); }
public static unsafe int LzRead(LzHandle handle, byte[] buffer, int offset, int count) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } if (offset < 0) { throw new ArgumentOutOfRangeException(nameof(offset)); } if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count)); } if (offset + count > buffer.Length) { throw new ArgumentOutOfRangeException(nameof(count)); fixed(byte *b = &buffer[offset]) { return(ValidateLzResult(Imports.LZRead(handle, b, count))); } }
public static int LzSeek(LzHandle handle, int offset, MoveMethod origin) { return(ValidateLzResult(Imports.LZSeek(handle, offset, origin))); }