public BinImageData(byte[] data) { if (ImploderWork.CheckImp(data)) { this.data = ImploderWork.Explode(data); } else { this.data = data; } }
private void LoadFile(string fileName) { btnExportAll.Enabled = false; romPath = fileName; tbPath.Text = Path.GetFileName(romPath); lvItems.Items.Clear(); pbImage.Image = null; rom = File.ReadAllBytes(romPath); itemsList = ImploderWork.FindImploded(rom); if (itemsList == null) { return; } int i = 0; while (i < itemsList.Count) { Tuple <int, int> pair = itemsList[i]; int offset = pair.Item1; int size = pair.Item2; byte[] data = new byte[size]; Array.Copy(rom, offset, data, 0, size); BinImageData bid = new BinImageData(data); Bitmap image; bid.ImageAndMask(out image); if (image == null) { itemsList.Remove(pair); continue; } image.Dispose(); string[] row = { string.Format("{0:000}", i + 1), string.Format("0x{0:X6}", offset), string.Format("0x{0:X4} ({0:00000})", size) }; var lvItem = new ListViewItem(row); lvItems.Items.Add(lvItem); i++; } if (lvItems.Items == null) { return; } btnExportAll.Enabled = true; lvItems.Items[0].Focused = true; lvItems.Items[0].Selected = true; lvItems.Select(); }