//public delegate bool ParseBinCallbackType(BinaryReader br, string id); //public delegate void ParseClassCallbackType(string classname, BinaryReader br); static public void Parse(BinaryReader br, ParseBinCallbackType cb) { bool readchunk = true; while (readchunk) { string id = MegaUtils.ReadString(br); if (id == "eoc") { break; } int skip = br.ReadInt32(); long fpos = br.BaseStream.Position; if (!cb(br, id)) { Debug.Log("Error Loading chunk id " + id); readchunk = false; // done break; } br.BaseStream.Position = fpos + skip; } }