e-CryptIt Engine - Compression Xojo Plugin

LZMA.Decompress Method

Decompresses the data that has been set by the input source, to the output destination.

Decompress() as Boolean

Parameters

Returns

Boolean
True if successful, else false.

Remarks

If both input and output have not been set then this function will return false.
If some error occurs during decompression then this function will return false.

Dim decompressor as LZMA
Dim sourceItem as FolderItem
Dim destItem as FolderItem

sourceItem = GetOpenFolderItem("*.*")

if sourceItem <> nil then
    if sourceItem.Name.Right(5) <> ".lzma" then
       MsgBox "The selected file is not lzma file"
       return
    end if
   
    destItem = sourceItem.Parent.Child(sourceItem.Name.Left(sourceItem.Name.Len-5))
   
    if destitem.Exists then
       MsgBox "Destination file already exists"
       return
    end if
    decompressor = new LZMA()
   
    decompressor.SetInputToStream(BinaryStream.Open(sourceItem))
    decompressor.SetOutputToStream(BinaryStream.Create(destItem))
   
    if not decompressor.Decompress() then
       MsgBox "Failed!"
    end if
end if

See Also

LZMA Class