Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        private void btnInstBoot_Click(object sender, EventArgs e)
        {
            var frm = new USBFrm(Strings.InstallABootLoader, Strings.ChooseBootloader, Strings.Install, false, "Grub2", "Grub4DOS", "Syslinux");

            frm.BtnClicked += (o, args) =>
            {
                frm.ProgressVisible = true;
                frm.SetProgress(5);
                try
                {
                    Utils.CallAdminProcess(frm.TheComboBox.SelectedItem.ToString().ToLower(), frm.SelectedUSB.Name);
                    frm.SetProgress(100);
                    MessageBox.Show(
                        string.Format(Strings.BootloaderInstalled,
                                      frm.TheComboBox.SelectedItem.ToString(),
                                      frm.SelectedUSB.Name), "SharpBoot", 0, MessageBoxIcon.Information);
                }
                catch (OperationCanceledException)
                {
                    return;
                }
            };
            frm.ShowDialog(this);
        }