public override void Read(Stream fs) { if (fs.Length < 4) return; BinaryReader sr = new BinaryReader(fs); char[] fileHeadChars = sr.ReadChars(4); //读取文件头判断文件类型,ABDB 意思即 Asset-Bundle-Data-Binary if (fileHeadChars[0] != 'A' || fileHeadChars[1] != 'B' || fileHeadChars[2] != 'D' || fileHeadChars[3] != 'B') return; int namesCount = sr.ReadInt32(); string[] names = new string[namesCount]; for (int i = 0; i < namesCount; i++) { names[i] = sr.ReadString(); } while (true) { if (fs.Position == fs.Length) break; string debugName = sr.ReadString(); string name = names[sr.ReadInt32()]; string shortFileName = sr.ReadString(); string hash = sr.ReadString(); int typeData = sr.ReadInt32(); int depsCount = sr.ReadInt32(); string[] deps = new string[depsCount]; if (!shortName2FullName.ContainsKey(shortFileName)) shortName2FullName.Add(shortFileName, name); for (int i = 0; i < depsCount; i++) { deps[i] = names[sr.ReadInt32()]; } AssetBundleData info = new AssetBundleData(); info.hash = hash; info.fullName = name; info.shortName = shortFileName; info.debugName = debugName; info.dependencies = deps; info.compositeType = (AssetBundleExportType)typeData; infoMap[name] = info; } sr.Close(); }
static int set_data(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Tangzx.ABSystem.AssetBundleInfo obj = (Tangzx.ABSystem.AssetBundleInfo)o; Tangzx.ABSystem.AssetBundleData arg0 = (Tangzx.ABSystem.AssetBundleData)ToLua.CheckObject <Tangzx.ABSystem.AssetBundleData>(L, 2); obj.data = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index data on a nil value")); } }
static int get_data(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Tangzx.ABSystem.AssetBundleInfo obj = (Tangzx.ABSystem.AssetBundleInfo)o; Tangzx.ABSystem.AssetBundleData ret = obj.data; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index data on a nil value")); } }
public virtual void Read(Stream fs) { StreamReader sr = new StreamReader(fs); char[] fileHeadChars = new char[6]; sr.Read(fileHeadChars, 0, fileHeadChars.Length); //读取文件头判断文件类型,ABDT 意思即 Asset-Bundle-Data-Text if (fileHeadChars[0] != 'A' || fileHeadChars[1] != 'B' || fileHeadChars[2] != 'D' || fileHeadChars[3] != 'T') return; while (true) { string debugName = sr.ReadLine(); if (string.IsNullOrEmpty(debugName)) break; string name = sr.ReadLine(); string shortFileName = sr.ReadLine(); string hash = sr.ReadLine(); int typeData = Convert.ToInt32(sr.ReadLine()); int depsCount = Convert.ToInt32(sr.ReadLine()); string[] deps = new string[depsCount]; if (!shortName2FullName.ContainsKey(shortFileName)) shortName2FullName.Add(shortFileName, name); for (int i = 0; i < depsCount; i++) { deps[i] = sr.ReadLine(); } sr.ReadLine(); // skip <-------------> AssetBundleData info = new AssetBundleData(); info.debugName = debugName; info.hash = hash; info.fullName = name; info.shortName = shortFileName; info.dependencies = deps; info.compositeType = (AssetBundleExportType)typeData; infoMap[name] = info; } sr.Close(); }
void Analyze(AssetBundleData abd) { if (!abd.isAnalyzed) { abd.isAnalyzed = true; abd.dependList = new AssetBundleData[abd.dependencies.Length]; for (int i = 0; i < abd.dependencies.Length; i++) { AssetBundleData dep = this.GetAssetBundleInfo(abd.dependencies[i]); abd.dependList[i] = dep; this.Analyze(dep); } } }