Jump to content

About This File

After a suggestion from Amaroth; I built this library to give other developers the core reading and saving functionality from WDBX Editor. This means that 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. I've moved to a class based decorator system as this is more intuitive. Included in this release is a separate library (WDBXLib.Defintions) with all the definitions that come with WDBX Editor - I've purposely separated these out as to provide more flexibility and to separate concerns. 

This library targets Microsoft .NET Framework 4.6.1. Source code and full examples can be found here.

Usage:

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

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+ (ADB files):

ADB files don't contain the structural 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. For example:

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

 


What's New in Version 1.0.1

Released

The following things have been changed:

  • Added reading capability for DBCache.bin, this mimics the way ADB files are read
  • Added Alpha (0.5.3) definitions to the definition library

×
×
  • Create New...