//throws IOException public void loadExternals(Dictionary <string, AssetFileEx> loadedAssets) { foreach (FileIdentifier external in externalsStruct.fileIDs) { String filePath = external.filePath; if (filePath == null || filePath.Length <= 0) { continue; } filePath = filePath.Replace("library/", "resources/"); string folder = Path.GetDirectoryName(sourceFile); string refFile = Path.Combine(folder, filePath);// sourceFile.resolveSibling(filePath); string refName = Path.GetFileNameWithoutExtension(refFile); if (File.Exists(refFile) && loadedAssets.ContainsKey(refName) == false) { Logger.Log("Loading dependency {0} for {1}" + new object[] { refFile, sourceFile }); AssetFileEx childAsset = new AssetFileEx(); bool ret = childAsset.load(refFile); if (ret) { loadedAssets[refName] = childAsset; childAsset.loadExternals(loadedAssets); external.assetFile = childAsset; } } } }
//private void TravellObjectData(ObjectData srcod) //{ // if (srcod.instance != null) // { // TravellObjectDataNode(srcod, srcod.instance); // } //} //private void TravellObjectDataValue(ObjectData srcod, object val) //{ // if (val != null) // { // if (val is PPtrObject || val is AssetInfo) // { // ObjectData od = GetObjectDataFromPtr(val); // if (od != null) // { // if (od.path == null || od.path.Length <= 0) // { // od.path = srcod.path; // } // } // } // } //} //private void TravellObjectDataNode(ObjectData srcod, FieldNode node) //{ // object val = node.value; // TravellObjectDataValue(srcod, val); // Dictionary<String, FieldNode> childnodes = node.getChilds(); // if (childnodes == null) return; // foreach (KeyValuePair<string, FieldNode> keypair in childnodes) // { // FieldNode childnode = keypair.Value; // TravellObjectDataNode(srcod, childnode); // } //} private void extractFile(Stream news, string path, string[] filter) { DataReader inr = new DataReader(news); AssetFileEx af = new AssetFileEx(); af.sourceFile = path; if (filter != null) { foreach (string type in filter) { af.extractTypes[type] = false; } } bool ret = af.load(inr); if (ret) { afs[af.sourceFile] = af; af.loadExternals(afs); } }