Building, loading and extracting VDFS archives used by the games "Gothic" and "Gothic II"
The main aim of the project is to provide a way for the Gothic Mod Build Tool project to extract and build VDFS archives programmatically instead of using external tools.
using VdfsSharp;
using System.IO;
//...
var reader = new VdfsReader("Anims.vdf");
var entries = reader.ReadEntries(false);
var humansMdh = entries.Where(entry => entry.Name == "HUMANS.MDH").First();
var content = reader.ReadEntryContent(humansMdh);
File.WriteAllBytes(@"_Work\Anims\_Compiled\Humans.mdh", content);
using VdfsSharp;
//...
var extractor = new VdfsExtractor("Anims.vdf");
extractor.ExtractFiles("_Work\Anims", ExtractOption.Hierarchy);
using VdfsSharp;
//...
var writer = new VdfsWriter("Scripts.vdf", "Scripts of my mod", GothicVersion.Gothic2);
writer.AddDirectory("_Work\Scripts");
writer.Save();