Beispiel #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();
        }
Beispiel #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);
        }
Beispiel #3
0
 private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     sw.Stop();
     pbxPrg.Visible = lblPercent.Visible = lblSpeed.Visible = lblProg.Visible = false;
     if (!e.Cancelled)
     {
         MessageBox.Show(Strings.DownComplete, "SharpBoot");
     }
     pbxPrg.Value  = 100;
     btnOK.Enabled = true;
     ControlBox    = true;
     ISOPath       = DownFile;
     IsoV          = SelectedISOV();
     DialogResult  = DialogResult.OK;
     Close();
 }
Beispiel #4
0
     private void cbxDetIso_SelectedIndexChanged(object sender, EventArgs e)
     {
         if (changing)
         {
             return;
         }
         if (cbxDetIso.SelectedIndex != -1 && cbxDetIso.SelectedItem != null && cbxDetIso.Visible)
         {
             IsoV = cbxDetIso.SelectedIndex == 0
                 ? new ISOV("other", "")
                 : selinfo2 == null
                     ? null
                     : selinfo2.LatestVersion ??
                    new ISOV("nover", selinfo2.Name, "", selinfo2.Filename, true)
             {
                 Parent = selinfo2
             }
         }
         ;
     }
 }
Beispiel #5
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();
        }