### Load and Apply Paramdefs to Params Source: https://github.com/soulsmods/soulsformatsnext/blob/master/FORMATS.md Loads parameters from a parambnd archive and applies paramdefs using a careful method to ensure compatibility. Includes editing and saving param data. ```cs var parms = new Dictionary(); var parambnd = BND3.Read(path); foreach (BinderFile file in parambnd.Files) { string name = Path.GetFileNameWithoutExtension(file.Name); var param = PARAM.Read(file.Bytes); // Recommended method: checks the list for any match, or you can test them one-by-one if (param.ApplyParamdefCarefully(paramdefs)) parms[name] = param; // Alternative method: applies without any additional verification param.ApplyParamdef(paramdefs.Find(def => def.ParamType == param.ParamType)); parms[name] = param; } // Editing param data PARAM weapons = parms["EquipParamWeapon"]; // Paramdef must be supplied to new rows in order to initialize cells correctly weapons.Rows.Add(new PARAM.Row(9900000, "My Super Cool Weapon", weapons.AppliedParamdef)); // Be mindful of the correct value type for each cell weapons[9900000]["weight"].Value = 100f; // Save each param, then the parambnd foreach (BinderFile file in parambnd.Files) { string name = Path.GetFileNameWithoutExtension(file.Name); if (parms.ContainsKey(name)) file.Bytes = parms[name].Write(); } parambnd.Write(path); ``` -------------------------------- ### Read BND3 from File Path or Byte Array Source: https://github.com/soulsmods/soulsformatsnext/blob/master/README.md Use the static Read method to create BND3 objects. Providing a file path is preferred for reduced memory consumption. ```cs BND3 bnd = BND3.Read(@"C:\your\path\here.chrbnd"); // or byte[] bytes = File.ReadAllBytes(@"C:\your\path\here.chrbnd"); BND3 bnd = BND3.Read(bytes); ``` -------------------------------- ### Read Custom XML Paramdefs Source: https://github.com/soulsmods/soulsformatsnext/blob/master/FORMATS.md Loads custom parameter definitions from XML files. Useful for games or modifications that do not ship with official paramdefs. ```cs var paramdefs = new List(); foreach (string path in Directory.GetFiles(dir, "*.xml")) { var paramdef = PARAMDEF.XmlDeserialize(path); paramdefs.Add(paramdef); } ``` -------------------------------- ### Compressing DCX with Specific Type Source: https://github.com/soulsmods/soulsformatsnext/blob/master/README.md When writing a new DCX file, a DCX.Type parameter is required to indicate the target game. DCX.Decompress can output the detected type. ```cs byte[] bndBytes = DCX.Decompress(@"C:\your\path\here.chrbnd.dcx", out DCX.Type type); DCX.Compress(bndBytes, type, @"C:\your\path\here.chrbnd.dcx"); // or byte[] bndBytes = DCX.Decompress(@"C:\your\path\here.chrbnd.dcx", out DCX.Type type); byte[] dcxBytes = DCX.Compress(bndBytes, type); File.WriteAllBytes(@"C:\your\path\here.chrbnd.dcx", dcxBytes); ``` -------------------------------- ### Read and Write DCX Compressed Files Source: https://github.com/soulsmods/soulsformatsnext/blob/master/README.md DCX files are automatically decompressed upon reading and compression is reapplied upon writing. The compression type is remembered. ```cs BND3 bnd = BND3.Read(@"C:\your\path\here.chrbnd.dcx"); bnd.Write(@"C:\your\path\here.chrbnd.dcx"); ``` -------------------------------- ### Generic DCX Decompression and Compression Source: https://github.com/soulsmods/soulsformatsnext/blob/master/README.md DCX files can be generically decompressed and compressed using static methods, operating directly on byte arrays. ```cs byte[] bndBytes = DCX.Decompress(@"C:\your\path\here.chrbnd.dcx"); BND3 bnd = BND3.Read(bndBytes); // or byte[] dcxBytes = File.ReadAllBytes(@"C:\your\path\here.chrbnd.dcx"); byte[] bndBytes = DCX.Decompress(dcxBytes); BND3 bnd = BND3.Read(bndBytes); ``` -------------------------------- ### Write BND3 to File Path or Byte Array Source: https://github.com/soulsmods/soulsformatsnext/blob/master/README.md The Write method creates a new file from a BND3 object. It can write to a specified path or return a byte array. ```cs bnd.Write(@"C:\your\path\here.chrbnd"); // or byte[] bytes = bnd.Write(); File.WriteAllBytes(@"C:\your\path\here.chrbnd", bytes); ``` -------------------------------- ### Read Original Paramdefbnd Source: https://github.com/soulsmods/soulsformatsnext/blob/master/FORMATS.md Reads original binary paramdef files from a BND3 archive. Ensures proper parsing of game-specific parameter definitions. ```cs var paramdefs = new List(); var paramdefbnd = BND3.Read(path); foreach (BinderFile file in paramdefbnd.Files) { var paramdef = PARAMDEF.Read(file.Bytes); paramdefs.Add(paramdef); } ``` -------------------------------- ### Change DCX Compression Type Source: https://github.com/soulsmods/soulsformatsnext/blob/master/README.md Modify the compression type by setting the Compression field or specifying it during the Write operation. ```cs BND3 bnd = BND3.Read(@"C:\your\path\here.chrbnd.dcx"); bnd.Write(@"C:\your\path\here.chrbnd", DCX.Type.None); // or BND3 bnd = BND3.Read(@"C:\your\path\here.chrbnd.dcx"); bnd.Compression = DCX.Type.None; bnd.Write(@"C:\your\path\here.chrbnd"); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.