void LoadBIF(BIFObject obj, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn) { List <BIFObject.Resource> resources = obj.resources.ToList(); //Debug.Log(resources.Count()); for (int i = 0; i < resources.Count(); i++) { BIFObject.Resource resource = resources[i]; ResourceType resType = (ResourceType)resource.ResType; if (!gffTypes.Contains(resType)) { continue; } try { //Debug.Log("Loading resource " + resource.ResRef); string className = "Aurora" + resType.ToString().ToUpper().Replace(" ", ""); // Load the resource from the RIM Stream stream = obj.GetResourceData(resource); GFFObject gffObject = new GFFLoader(stream).GetObject(); LoadGFF(gffObject, defs, className, compat, existsIn); } catch { // Just keep going Debug.LogWarning("Failed to load " + resource.ID); } } }
void LoadGFFsFromBIFs(string dataDir, Dictionary <string, ClassDefinition> defs, Compatibility compat, ExistsIn existsIn) { // We load every BIF file in the game files // Find the list of module names // TODO: Implement this for KOTOR 2, which uses a different file structure foreach (string filename in Directory.GetFiles(dataDir)) { // We don't actually use the key here BIFObject obj = new BIFObject(filename, null); LoadBIF(obj, defs, compat, existsIn); } }