private void menuItem_ExpandIso_Click(object sender, EventArgs e) { bool isPsx = currentStream.Length % PatcherLib.Iso.IsoPatch.SectorSizes[PatcherLib.Iso.IsoPatch.IsoType.Mode2Form1] == 0; if (isPsx) { DialogResult result = DialogResult.None; bool expanded = AllSprites.DetectExpansionOfPsxIso(currentStream); if (!expanded && (result = MyMessageBox.Show(this, "Are you sure you want to Expand this ISO?", "Expand ISO?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2)) == DialogResult.Yes) { AllSprites.ExpandPsxIso(currentStream); AllSprites s = AllSprites.FromIso(currentStream, true); allSpritesEditor1.BindTo(s, currentStream); tabControl1.Enabled = true; spriteMenuItem.Enabled = true; sp2Menu.Enabled = true; AllOtherImages otherImages = AllOtherImages.FromIso(currentStream); allOtherImagesEditor1.BindTo(otherImages, currentStream); } } }
private void openIsoMenuItem_Click(object sender, EventArgs e) { openFileDialog.Filter = "ISO files (*.bin, *.iso, *.img)|*.bin;*.iso;*.img"; openFileDialog.FileName = string.Empty; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { Stream openedStream = File.Open(openFileDialog.FileName, FileMode.Open, FileAccess.ReadWrite); if (openedStream != null) { bool psx = openedStream.Length % PatcherLib.Iso.IsoPatch.SectorSizes[PatcherLib.Iso.IsoPatch.IsoType.Mode2Form1] == 0; bool psp = openedStream.Length % PatcherLib.Iso.IsoPatch.SectorSizes[PatcherLib.Iso.IsoPatch.IsoType.Mode1] == 0; if (psp || psx) { bool expanded = psx && AllSprites.DetectExpansionOfPsxIso(openedStream); if (currentStream != null) { currentStream.Flush(); currentStream.Close(); currentStream.Dispose(); } currentStream = openedStream; AllSprites s = AllSprites.FromIso(currentStream, false); allSpritesEditor1.BindTo(s, currentStream); tabControl1.Enabled = true; spriteMenuItem.Enabled = true; sp2Menu.Enabled = true; menuItem_ExpandIso.Enabled = psx && !expanded; AllOtherImages otherImages = AllOtherImages.FromIso(currentStream); allOtherImagesEditor1.BindTo(otherImages, currentStream); Text = string.Format(titleFormatString, Path.GetFileName(openFileDialog.FileName)); } } } }