private void button1_Click(object sender, EventArgs e) { string path = ""; path = AndiFileDialog.OpenDialog(path, _LastPath, "OVA9 Table - File Open", "Any Files|*.*|Bin Files|*.bin"); if (path != "") { a = new FileStream(path, FileMode.Open); int b = (int)(a.Length / 32); object[,] datatemp = new object[b, 9]; for (int i = 0; i < b; i++) { byte[] buffernew = new byte[4]; a.Position = 0 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 0] = BitConverter.ToUInt32(buffernew, 0); a.Position = 4 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 1] = BitConverter.ToUInt32(buffernew, 0).ToString("x8"); a.Position = 8 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 2] = BitConverter.ToUInt32(buffernew, 0); a.Position = 12 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 3] = BitConverter.ToUInt32(buffernew, 0); a.Position = 16 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 4] = BitConverter.ToUInt32(buffernew, 0).ToString("x8"); a.Position = 20 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 5] = BitConverter.ToUInt32(buffernew, 0).ToString("x8"); a.Position = 24 + i * 32; a.Read(buffernew, 0, 4); datatemp[i, 6] = BitConverter.ToUInt32(buffernew, 0); a.Position = 28 + i * 32; buffernew = new byte[3]; a.Read(buffernew, 0, 3); datatemp[i, 7] = BitConverter.ToUInt16(buffernew, 0).ToString("x8"); a.Position = 31 + i * 32; buffernew = new byte[1]; a.Read(buffernew, 0, 1); datatemp[i, 8] = (int)buffernew[0]; } FillGrid.Build(grid1, b, 9, "OVA#", "RAM Addr", "RAM Size", "BSS Size", "Static InitStart", "Static InitEnd", "File ID#", "RESERVED", "Compressed Flag"); Fill(grid1, datatemp); } }
public static void WildEx4(int lenghtdata, Grid grid1, string[] pkmname, Stream a) { string[] data = new string[lenghtdata]; for (int i = 0; i < lenghtdata; i++) { byte[] temp = new byte[4]; a.Position = i * 4; a.Read(temp, 0, 4); data[i] = pkmname[BitConverter.ToUInt32(temp, 0) - 1]; } FillGrid.Build(grid1, lenghtdata); FillGrid.Fill(grid1, data); }