Added allz-compressor command to compress Aqualead Files with Aqualead LZ compression algorithm (ALLZ).

This commit is contained in:
zapan 2024-04-25 13:27:46 +02:00
parent 9f1f9d6264
commit ca672dfa0f
2 changed files with 42 additions and 2 deletions

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -21,4 +21,13 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="AuroraLib.Compression" Version="1.0.6" />
<Reference Include="AuroraLib.Compression">
<HintPath>..\..\AuroraLib.Compression\src\AuroraLib.Compression\bin\Debug\net6.0\AuroraLib.Compression.dll </HintPath>
</Reference>
<PackageReference Include="Pfim" Version="0.11.2" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>
</Project> </Project>

View file

@ -16,8 +16,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Pipes;
using System.Text; using System.Text;
using AuroraLib.Compression;
using AuroraLib.Compression.Algorithms;
using Path = System.IO.Path; using Path = System.IO.Path;
namespace DgfTxmConvert namespace DgfTxmConvert
@ -78,6 +80,24 @@ namespace DgfTxmConvert
}); });
}); });
app.Command("allz-compressor", config =>
{
config.FullName = "Compress file with ALLZ";
config.Description = "Converts flat file to compressed.";
var datPathArg = config.Argument("datPath", "Path of the file to compress").IsRequired();
datPathArg.Accepts().ExistingFile();
var outPathArg = config.Argument("outBase", "Path of the output file");
outPathArg.Accepts().LegalFilePath();
config.HelpOption();
config.OnExecute(() =>
{
AllzCompressor(datPathArg.Value, outPathArg.Value);
});
});
app.Command("convert-txm", config => app.Command("convert-txm", config =>
{ {
config.FullName = "Convert TXM to image"; config.FullName = "Convert TXM to image";
@ -355,6 +375,17 @@ namespace DgfTxmConvert
} }
static void AllzCompressor(string datPathArg, string outPathArg = null)
{
if (outPathArg == null)
outPathArg = Path.GetFullPath(datPathArg) + $"/output.dat";
using Stream sourceStr = File.OpenRead(datPathArg);
using var destStr = File.Create(outPathArg);
new ALLZ().Compress(sourceStr, destStr);
}
static void ConvertDat(string path, string outBase = null) static void ConvertDat(string path, string outBase = null)
{ {
if (outBase == null) outBase = Path.GetDirectoryName(path); if (outBase == null) outBase = Path.GetDirectoryName(path);