Esempio n. 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (IsDownload)
            {
                IsoV = SelectedISOV();
                if (IsoV != null && IsoV.DownloadLink != "")
                {
                    sfdIso.FileName = Path.GetFileName(IsoV.DownloadLink);
                }

                if (sfdIso.ShowDialog(this) == DialogResult.OK)
                {
                    btnOK.Enabled = false;
                    ControlBox    = false;

                    DownFile = sfdIso.FileName;
                    DownloadStuff();
                }
            }
            else
            {
                if (IsoV == null)
                {
                    IsoV = ISOInfo.GetFromFile(ISOPath, true);
                }
            }

            tokenSource.Cancel();
        }
Esempio n. 2
0
        public void AddImage(string filePath, ISOV ver = null)
        {
            if (CurImages.Count(x => x.FilePath == filePath) != 0)
            {
                return;
            }

            var name = Path.GetFileNameWithoutExtension(filePath);
            var desc = "";
            var cat  = "";

            if (ver?.Hash == "nover")
            {
                name = ver.Parent.Name;
                desc = ver.Parent.Description;
                cat  = ver.Parent.CategoryTxt;
            }
            else
            {
                if (automaticallyAddISOInfoToolStripMenuItem.Checked && ver?.Hash != "other")
                {
                    ver = ver ?? ISOInfo.GetFromFile(filePath, new FileInfo(filePath).Length > 10000000);
                    if (ver == null)
                    {
                        MessageBox.Show(Path.GetFileName(filePath) + "\n\n" + Strings.CouldntDetect, "SharpBoot",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        name = ver.Name;
                        desc = ver.Parent.Description;
                        cat  = ver.Parent.CategoryTxt;
                    }
                }
            }


            var im = new ImageLine(name, filePath, desc, cat,
                                   typ: filePath.ToLower().EndsWith("img") ? EntryType.IMG : EntryType.ISO);

            CurImages.Add(im);

            RefreshOutputSize();


            lvIsos.Rows.Add(name, FileIO.GetFileSizeString(filePath), cat, desc, filePath);
        }
Esempio n. 3
0
        private void DetectOS()
        {
            th = new Thread(() =>
            {
                Localization.UpdateThreadCulture();

                Invoke((MethodInvoker)(() => pbxLoading.Visible = true));

                var resk = ISOInfo.GetFromFile(ISOPath, false, tokenSource.Token);

                Invoke((MethodInvoker)(() =>
                {
                    if (resk == null)
                    {
                        cbxDetIso.SelectedIndex = 0;
                    }
                    else
                    {
                        IsoV = resk;
                        for (var index = 0; index < cbxDetIso.Items.Count; index++)
                        {
                            dynamic it = cbxDetIso.Items[index];
                            if (it.Val == resk.Parent)
                            {
                                changing = true;
                                cbxDetIso.SelectedIndex = index;

                                break;
                            }
                        }
                    }

                    pbxLoading.Visible = false;
                }));
                changing = false;
            });

            th.Start();
        }