private void bAdd_Click(object sender, EventArgs e) { if (txbFile == null) return; if (listView.SelectedIndices.Count == 0) return; var ind = listView.SelectedIndices[0] + 1; var newTXBObject = new TXBObject(); txbFile.TXBObjects.Insert(ind, newTXBObject); listView.Items.Insert(ind, new ListViewItem(new [] { newTXBObject.Name, "", parameterName[(int)newTXBObject.minFilter], parameterName[(int)newTXBObject.magFilter] })); RecalculateIndexes(ind); }
public override void Read(byte[] fileRaw) { base.Read(fileRaw); TXBObjects.Clear(); if (!IsLittleEndian(fileRaw)) { ReverseEndianness(fileRaw); } var objectNumber = BitConverter.ToInt32(fileRaw, 0x10); var objectPointer = BitConverter.ToInt32(fileRaw, 0x14); var sb = new StringBuilder(); for (int i = 0; i < objectNumber; i++) { var newTXB = new TXBObject(); StrangeIsntIt(fileRaw, objectPointer + i * 5 * 4, 0); newTXB.minFilter = (GL_TEXTURE_MIN_FILTER)BitConverter.ToInt16(fileRaw, objectPointer + i * 5 * 4 + 0x8); newTXB.magFilter = (GL_TEXTURE_MAG_FILTER)BitConverter.ToInt16(fileRaw, objectPointer + i * 5 * 4 + 0xA); StrangeIsntIt(fileRaw, objectPointer + i * 5 * 4 + 0xC, 0); StrangeIsntIt(fileRaw, objectPointer + i * 5 * 4 + 0x10, 0); var namePointer = BitConverter.ToInt32(fileRaw, objectPointer + i * 5 * 4 + 4); for (int j = namePointer; fileRaw[j] != 0x00; j++) { sb.Append((char)fileRaw[j]); } newTXB.Name = sb.ToString(); sb.Clear(); TXBObjects.Add(newTXB); } }