public void LoadFile(string file) { var bundle = VfsManager.CreateBundle(Path.GetFileName(file)); var reader = new MWBundleReader(file, null); reader.Read(); }
public void LoadMapStream() { var bundleFile = Path.Combine(_directory, "TRACKS", "L2RA.BUN"); var streamFile = Path.Combine(_directory, "TRACKS", "STREAML2RA.BUN"); var msr = new MWMapStreamReader( bundleFile, streamFile ); msr.Init(); msr.Read(); var sections = msr.GetSections(); foreach (var section in sections) { var sectionBundle = VfsManager.CreateBundle(section.Name); Console.WriteLine($"Reading section: {section.Name} @ 0x{section.Offset:X8}"); // Create a new reader var reader = new MWBundleReader(streamFile, new BundleReadOptions { StartPosition = section.Offset, EndPosition = section.Offset + section.Size }); var resources = reader.Read(); foreach (var resource in resources) { if (resource is TexturePack tpk) { sectionBundle.MountResource(VfsManager.CreateTexturePackResource(tpk)); } } VfsManager.Instance .FindBundle(msr.MapStreamId) .MountBundle(sectionBundle); } }