private void ApplySHA1s() { int count = 0; foreach (byte[] sha1 in Sha1List) { if (count < Header.ebxCount) { EbxEntry e = EbxList[count]; e._sha1 = sha1; EbxList[count] = e; } if (count >= Header.ebxCount && count < Header.ebxCount + Header.resCount) { ResEntry e = ResList[count - (int)Header.ebxCount]; e._sha1 = sha1; ResList[count - (int)Header.ebxCount] = e; } if (count >= Header.ebxCount + Header.resCount) { ChunkEntry e = ChunkList[count - (int)(Header.ebxCount + Header.resCount)]; e._sha1 = sha1; ChunkList[count - (int)(Header.ebxCount + Header.resCount)] = e; } count++; } }
private void ReadEbxListData(Stream data, bool fast = false) { for (int i = 0; i < Header.ebxCount; i++) { EbxEntry e = EbxList[i]; e._data = ReadPayload(data, e.ucsize, fast); EbxList[i] = e; } }
private void ReadEbxList(Stream data) { EbxList = new List <EbxEntry>(); for (int i = 0; i < Header.ebxCount; i++) { EbxEntry b = new EbxEntry(); b.nameOffset = Helpers.ReadLEInt(data); b.ucsize = Helpers.ReadLEInt(data); EbxList.Add(b); } }
private void ReadEbxListNames(Stream data) { long startOffset = data.Position; for (int i = 0; i < Header.ebxCount; i++) { EbxEntry e = EbxList[i]; data.Seek(startOffset + e.nameOffset, 0); e._name = Helpers.ReadNullString(data); EbxList[i] = e; } }
private void WriteStringTable(Stream s) { List <string> list = new List <string>(); bool found; foreach (EbxEntry e in EbxList) { found = false; foreach (string str in list) { if (e._name == str) { found = true; break; } } if (!found) { list.Add(e._name); } } foreach (ResEntry e in ResList) { found = false; foreach (string str in list) { if (e._name == str) { found = true; break; } } if (!found) { list.Add(e._name); } } int pos = 0; foreach (string str in list) { Helpers.WriteNullString(s, str); for (int i = 0; i < EbxList.Count; i++) { if (EbxList[i]._name == str) { EbxEntry e = EbxList[i]; e.nameOffset = pos; EbxList[i] = e; } } for (int i = 0; i < ResList.Count; i++) { if (ResList[i]._name == str) { ResEntry e = ResList[i]; e.nameOffset = pos; ResList[i] = e; } } pos += 1 + str.Length; } while (s.Position % 0x10 != 0) { s.WriteByte(0); } }
private void ReadEbxList(Stream data) { EbxList = new List<EbxEntry>(); for (int i = 0; i < Header.ebxCount; i++) { EbxEntry b = new EbxEntry(); b.nameOffset = Helpers.ReadLEInt(data); b.ucsize = Helpers.ReadLEInt(data); EbxList.Add(b); } }