Skip to content

Instantly share code, notes, and snippets.

@JohnnyonFlame
Last active June 17, 2022 01:31
Show Gist options
  • Save JohnnyonFlame/b979ae7a8da2a0f61cd84dfd1c533e92 to your computer and use it in GitHub Desktop.
Save JohnnyonFlame/b979ae7a8da2a0f61cd84dfd1c533e92 to your computer and use it in GitHub Desktop.
EiffelExtractor - Extract ParisEngine assets.
// File Extractor for games using the ParisEngine (e.g. Panzer Paladin, TMNT: Shredder's Revenge)
// To compile this: mcs EiffelExtractor.cs /r:DotNetZip.dll
// This is free software, licensed under BSD-0, by Johnny on Flame, 2022.
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using Ionic.Zlib;
namespace FNARepacker
{
class Program
{
static IEnumerable<string> FilesInDirRecursive(string dir)
{
// If this is a file, just return it.
FileAttributes attr = File.GetAttributes(dir);
if ((attr & FileAttributes.Directory) != FileAttributes.Directory) {
yield return dir;
yield break;
}
foreach (var f in Directory.GetFiles(dir))
yield return f;
foreach (var d in Directory.GetDirectories(dir))
foreach (var f in FilesInDirRecursive(d))
yield return f;
}
static string[] COMPRESSED = new string[] {
".zpbn",
".zxnb",
".zjson"
};
static void Main(string[] args)
{
foreach (var file in FilesInDirRecursive(args[0]))
{
if (Array.Exists(COMPRESSED, x => x == Path.GetExtension(file).ToLower()))
{
string newFilepath = Path.ChangeExtension(file, Path.GetExtension(file).Remove(1, 1));
using (FileStream input = File.Open(file, FileMode.Open))
using (DeflateStream deflate = new DeflateStream(input, CompressionMode.Decompress))
using (FileStream output = File.Open(newFilepath, FileMode.Create))
deflate.CopyTo(output);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment