The ClientHandler is the base object that controls the CAS(C).
The path passed to ClientHandler should be the base path of the game install. E.g. where the game executables are. Upon creation, the client handler will load everything required for CASC operation.
string path = @"C:\ow\game\Overwatch";
ClientHandler clientHandler = new ClientHandler(path);
Logging is handled through the TACTLib.Logger class. It has events that are triggered by TACTLib during runtime. Basic logging can be enabled by using TACTLib.Logger.RegisterBasic. That method also serves as an example of how to do custom logging. (see Logger.cs)
// enables the default basic logger. should be called *before* creating the client
Logger.RegisterBasic();
(none of this is true yet)
ClientHandler client = new ClientHandler(path);
if (client.VFS == null) {
// invalid install
return;
}
VFSFileTree vfs = client.VFS;
using (Stream stream = vfs.Open(@"zone\base.xpak")) {
// do whatever
}
foreach (string fileName in vfs.Files.Where(x => x.StartsWith(@"zone\"))) {
using(Stream stream = vfs.Open(fileName)) {
// could do this too
}
}
TACTLib is used internally in TankLib/DataTool.
ClientHandler client = new ClientHandler(path);
ProductHandler_Tank tankHandler = client.ProductHandler as ProdcuctHandler_Tank;
if (tankHandler == null) {
// not a valid overwatch install
return;
}
using (Stream stream = tankHandler.OpenFile(0xE00000000000895)) { // open any asset you want
// in this case, parse the material
}
Not all features are implemented yet. Anything below is a concept.
ClientHandler client = new ClientHandler(path, new ClientCreateArgs {
HandlerArgs = new ClientCreateArgs_WorldOfWarcraft {
ListFile = "https://raw.githubusercontent.com/wowdev/wow-listfile/master/listfile.txt"
}
});
ProductHandler_WorldOfWarcraftV6 wowHandler = client.ProductHandler as ProductHandler_WorldOfWarcraftV6;
if (wowHandler == null) {
// not a valid warcraft install
return;
}
using (Stream stream = wowHandler.OpenFile("world/maps/azuremyst isle (7.3 intro)/azuremyst isle (7.3 intro).wdt")) { // open any asset you want
// in this case, parse wdt
}
foreach(string file in wowHandler.GetFiles("world")) {
// will be empty if listfile is invalid
}
foreach(string dir in wowHandler.GetDirectories("world")) {
// will be empty if listfile is invalid
}