private void StartWork(bool usb) { Form ask = null; if (usb) { var fs = new[] { "NTFS", "FAT32", "FAT16", "FAT12" }.AddRecommended( CurImages.Any(x => x.SizeB >= uint.MaxValue) ? 0 : 1); ask = new USBFrm(Strings.CreateMultibootUsb, Strings.Filesystem, Strings.OK, true, fs); } else { ask = new AskPath(); } if (ask.ShowDialog() == DialogResult.OK) { var fn = usb ? ((USBFrm)ask).SelectedUSB.Name.ToUpper().Substring(0, 3) : ((AskPath)ask).FileName; var g = new GenIsoFrm(fn, usb); g.WorkFinished += delegate { g_GenerationFinished(g); }; g.Title = txtTitle.Text; if (usb) { g.filesystem = ((USBFrm)ask).TheComboBox.SelectedItem.ToString().RemoveRecommended(); } switch (cbxBackType.SelectedIndex) { case 0: g.IsoBackgroundImage = ""; break; case 1: g.IsoBackgroundImage = txtBackFile.Text; break; default: g.IsoBackgroundImage = "$$NONE$$"; break; } g.Res = ((dynamic)cbxRes.SelectedItem).Val; g.Images = CurImages.Select( x => new ImageLine(x.Name, x.FilePath, x.Description, x.Category, x.CustomCode, x.EntryType)).ToList(); g.CustomFiles = CustomFiles; g.ShowDialog(this); FileIO.ClrTmp(); } }
private void g_GenerationFinished(GenIsoFrm g) { FileIO.ClrTmp(); Localization.UpdateThreadCulture(); if (g.abort) { return; } if ( MessageBox.Show(this, Strings.IsoCreated.Replace(@"\n", "\n"), Strings.IsoCreatedTitle, MessageBoxButtons.YesNo) == DialogResult.Yes) { if (g.filesystem == "NTFS") { Thread.Sleep(1500); // let Windows notice the FS changes } QEMU.LaunchQemu(g.OutputFilepath, g._usb); } }