Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

barncastle/WDBXLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WDBXLib

About

This a library that contains all of the core reading and saving functionality from WDBX Editor. This means this library has full support for reading and saving all release versions of DBC, DB2, WDB and ADB.

Just like WDBX Editor the reader requires a definition to load files correctly. Included is a port of the same XML definitions provided with WDBX Editor, these can be found in the WDBXLib.Defintions library.

You will need Microsoft .NET Framework 4.6.1 to run this application

Useage:

Below is an example of a definition and using it to read and write to a file.

[DBTable(Expansion.WotLK)] //Defines the build number
public class CharacterFacialHairStyles
{
	[DBKey(AutoGenerated: true)] //Defines the Id column
	public int Id { get; set; }
	public int RaceId { get; set; }
	public int GenderId { get; set; }
	public int VariationId { get; set; }

	[DBField(ArraySize: 5)] //Defines the array size
	public int[] GeoSetId { get; set; }
}

//Reading, editing and writing a DB file with the above definition
var entry = DBReader.Read<CharacterFacialHairStyles>(@"TestFiles\CharacterFacialHairStyles.dbc");
entry.Rows[0].RaceId = 6; //Update RaceId for the first row
DBReader.Write(entry, @"TestFiles\CharacterFacialHairStyles.dbc");

Definition Attributes

The following are the available attributes and their properties for creating definitions:

DBTable is a mandatory attribute and must have one of the below set:

  • Expansion: This is the final build of each expansion in the form of an enum
  • Build: This is the build number for when an expansion value is not applicable

DBKey is a mandatory attribute and must be present on a single Int32 field. It has one optional property:

  • AutoGenerated: Used on a few special DB files that don't contain inline Ids

DBField is an optional attribute and contains the following optional properties:

  • ArraySize: This defines the size of the array
  • Padding: This defines any additional column padding as seen in WoD DB2 files
  • DefaultValue: This defines the common data value as per the WDB6 spec

Examples can be found in the test project.

Rows

The DBEntry rows are contained in a special collection class. Using the provided methods the Ids are automatically adjusted accordingly. However if you edit the Ids from the collection directly the Ids will need to be manually maintained, if duplicates are found the library will throw an exception on save.

Included are a few additional methods and properties not found in a standard list.

  • NextKey: returns the next Id available
  • HasDuplicateKeys: returns a boolean indicating if any Id is used more than once
  • FindByKey: returns an object by Id
  • RemoveByKey: removes an object by Id

LocalizedString

DBC file's localization was handled by a string array followed by a mask. Included is a special LocalizedString class designed for this purpose. It has the following properties:

  • Locale: The value for that specific DBC's language (readonly)
  • Values: A string array of all locales
  • Mask: The mask value
  • this[TextWowEnum locale]: An indexer that gets/sets the value for a specific language

WCH5+ / DBCache.bin

These files don't contain the structual information to be loaded directly so require loading the header information from the associated DB2 file first. To cater for this a ReadHeader function is exposed in the DBReader class which is then feed into the Read function.

var counterpart = DBReader.ReadHeader(@"TestFiles\ArtifactPowerRank.db2");
var entry = DBReader.Read<ArtifactPowerRank>(@"TestFiles\ArtifactPowerRank.adb", counterpart);

About

A library supporting WDBXEditor's core functionality

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages