[DBC] Java class file menu

User Tag List

Results 1 to 1 of 1
  1. #1
    danielrhodea's Avatar Master Sergeant
    Reputation
    11
    Join Date
    Apr 2010
    Posts
    107
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [DBC] Java class file

    Hi, I'm new here and I wanted to contribute something, this is the basis of a java class I'm writing to read .dbc files from the filesystem, so far im quite sure it returns true values of string size, record size, field size and record count, I have only verified this using taliis to read the .dbc files, anyway I'm planning to contribute alt more but here it is for now

    Code:
    import java.io.*;
    import java.lang.String;
    import java.lang.Integer;
    
    public class DBCFile
    {
    	public DBCFile(String _filename)
    	{
    		File f = new File(_filename);
    		if(f.canRead())
    			filename = _filename;
    		else
    			error = true;
    	}
    
    	// Open database. It must be openened before it can be used.
    	public void open()
    	{
    		try
    		{
    			FileReader f = new FileReader(filename);
    			char[] hdr = new char[4];
    			
    			char[] na = new char[4];
    			char[] nb = new char[4];
    			char[] es = new char[4];
    			char[] ss = new char[4];
    
    			f.read(hdr); // Number of records
    			
    			assert(String.copyValueOf(hdr) == "WDBC");
    			header = String.copyValueOf(hdr);
    			f.read(na); // Number of record
    			recordCount = (na[0]) | (na[1]) | (na[2]) | (na[3]);
    			f.read(nb); // Number of fields
    			fieldCount = (nb[0]) | (nb[1]) | (nb[2]) | (nb[3]);
    			f.read(es); // Size of a record
    			recordSize = (es[0]) | (es[1]) | (es[2]) | (es[3]);
    			f.read(ss); // String size
    			stringSize = (ss[0]) | (ss[1]) | (ss[2]) | (ss[3]);
    			       
    			assert(fieldCount *4 == recordSize);
    			
    			
    			data = new char[recordSize * recordCount + stringSize];
    			
    			stringTable = new char[(data.length) + recordSize * recordCount];
           		
    			f.read(data);
           		/*
    			String tmp = "";
    			for(int i=1*recordSize+stringSize;i<stringSize;i++)
    				tmp += String.valueOf(data[i]);
    			System.out.println(tmp);
    			*/
    			f.close();
    		}
    		catch(IOException exc)
    		{
    			System.out.println("IOException"+exc.getMessage());
    		}
    		trace();// uncomment to hide debug info
    	}
    	private Boolean error = false;
    	public Boolean hasError(){
    		return error;
    	}
    	public void trace()
    	{
    		System.out.println("Traced output... header:"+header+" record count:"+recordCount+" field count:"+fieldCount+" record size:"+recordSize+" string size:"+stringSize+" error:"+hasError());
    	}
    	private String header;
    	private String filename;
    	private int recordSize;
    	private int recordCount;
    	private int fieldCount;
    	private int stringSize;
        private char[] data;
        private char stringTable[];
    }

    [DBC] Java class file

Similar Threads

  1. DBC's invalid file format
    By Supah in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 06-09-2009, 08:23 AM
  2. Where are the DBC files in wow ?
    By raptornl in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 01-05-2007, 01:19 PM
  3. NEW files in the DBC
    By sportstud10124 in forum World of Warcraft Model Editing
    Replies: 10
    Last Post: 12-29-2006, 09:32 AM
  4. DBC files
    By Tayo in forum WoW ME Questions and Requests
    Replies: 9
    Last Post: 08-24-2006, 05:48 AM
  5. DBC files
    By Tayo in forum World of Warcraft Model Editing
    Replies: 3
    Last Post: 08-22-2006, 01:33 PM
All times are GMT -5. The time now is 11:26 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search