[Archive] WDBXLib 1.0.1
[Archive] WDBXLib 1.0.1
Archived author: importer • Posted: 2017-08-07T21:01:42+00:00
Original source
Original source
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.