Skip to content

Building, loading and extracting VDFS archives used by the games Gothic & Gothic 2 NotR

License

Notifications You must be signed in to change notification settings

Szmyk/VdfsSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VdfsSharp

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.

Example

Reading

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);

Extracting

using VdfsSharp;

//...

var extractor = new VdfsExtractor("Anims.vdf");

extractor.ExtractFiles("_Work\Anims", ExtractOption.Hierarchy);

Building

using VdfsSharp;

//...

var writer = new VdfsWriter("Scripts.vdf", "Scripts of my mod", GothicVersion.Gothic2);

writer.AddDirectory("_Work\Scripts");

writer.Save();