Amiga.FileFormats.LHA 0.4.0

dotnet add package Amiga.FileFormats.LHA --version 0.4.0                
NuGet\Install-Package Amiga.FileFormats.LHA -Version 0.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Amiga.FileFormats.LHA" Version="0.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Amiga.FileFormats.LHA --version 0.4.0                
#r "nuget: Amiga.FileFormats.LHA, 0.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Amiga.FileFormats.LHA as a Cake Addin
#addin nuget:?package=Amiga.FileFormats.LHA&version=0.4.0

// Install Amiga.FileFormats.LHA as a Cake Tool
#tool nuget:?package=Amiga.FileFormats.LHA&version=0.4.0                

Amiga LHA File Format

This package allows reading and writing LHA archives.

Reading supports the following compression methods:

  • -lh0- (uncompressed)
  • -lh5-
  • -lh6-
  • -lh7-
  • -lz5-
  • -lhd- (directory)

Writing supports all of the above except for -lz5-.

Requirements

This is all written in pure C#, so there are no dependencies beside .NET.

Virtual File System

The ILHA interface implements a virtual file system interface IVirtualFileSystem which allows access to files (IFile) and directories (IDirectory) in a tree hierarchy.

Usage

Reading an archive.

var archive = LHAReader.LoadLHAFile("myArchive.lha");

var rootDir = archive.RootDirectory;
var myFile = rootDir.GetFile("internalFile.txt");

Console.WriteLine($"File Size: {myFile.Size}");

var myFileData = myFile.Data;

Writing an archive.

var result = LHAWriter.WriteLHAFile("myNewArchive.lha", archive, CompressionMethod.LH5);

if (result == LHAWriteResult.Success)
{
    Console.WriteLine("It worked!");
}

Packing a directory of text files.

var result = LHAWriter.WriteLHAFile("myNewArchive.lha", "dirToMyFiles", "*.txt", CompressionMethod.LH5);

if (result == LHAWriteResult.Success)
{
    Console.WriteLine("It worked!");
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0 125 8/14/2024
0.3.0 109 8/14/2024
0.1.0 110 8/13/2024

Use with caution. This is still in beta phase and not all features/operations are supported.