Originally Posted by
Ravenheart
Greetings, fellow C#-coding MMOwners. I've downloaded the 'wowdatamanager' dll library ( wowdatamanager - Google Code ), that i want to use mainly for DBC and ADT editing - or atleast try to and experiment with it. But everytime i declare the variable, or try to open the file, i'm getting NullException, or the app cannot find the specified file. Could someone please help me out, how to use that lib properly? Thanks in advance
I've never used the library so bear with me as I'm flying blind here.
I'm guessing the null exception happens when you try to do anything with the MpqStream that is returned from MPQManager
Here is the open file code :
Code:
public MpqStream OpenFile(string FileName)
{
foreach (MpqArchive archive in MPQArchives)
{
if (archive.FileExists(FileName))
{
return archive.OpenFile(FileName);
}
}
return null;
}
The last line there is likely what is killing you. Add a check to see if it's null before you try to manipulate what you get back from that function.
Also this may help :
Code:
"Data\\patch-2.MPQ"
"Data\\patch.MPQ"
"Data\\lichking.MPQ"
"Data\\expansion.MPQ"
"Data\\common-2.MPQ"
"Data\\common.MPQ"
"Data\\enUS\\patch-enUS-2.MPQ"
"Data\\enUS\\patch-enUS.MPQ"
"Data\\enUS\\lichking-locale-enUS.MPQ"
"Data\\enUS\\expansion-locale-enUS.MPQ"
"Data\\enUS\\locale-enUS.MPQ"
"Data\\enUS\\base-enUS.MPQ"
This is a list of archives that the app will actually open. If you dont input these as archive names the fuction will return null. Also the MPQPath must be correct, otherwise it will not find the file and still return null.
In short you'll have something that looks sorta like this :
Code:
DataManager MahBoss = new DataManager("C:\\Program Files\\World of Warcraft\\");
//this is the part i'm not sure of
//either
MpqStream TheStream = MahBoss.MPQLoader.OpenFile("C:\\Program Files\\World of Warcraft\\Data\\enUS\\base-enUS.MPQ");
//or
MpqStream TheStream = MahBoss.MPQLoader.OpenFile("Data\\enUS\\base-enUS.MPQ");
if(TheStream == null)
{
//flip shit
}
else
{
//manage it somehow
}