GetFromFile() private method

private GetFromFile ( string filename, bool fast ) : ISOV
filename string
fast bool
return ISOV
コード例 #1
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 > 750000000));
                    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);

            SetSize();


            lvIsos.Rows.Add(name, Program.GetFileSizeString(filePath), cat, desc, filePath);
        }
コード例 #2
0
        private void md5stuff()
        {
            th = new Thread(() =>
            {
                Invoke((MethodInvoker)(() => pbxLoading.Visible = true));

                var sw = new Stopwatch();
                sw.Start();
                var resk = ISOInfo.GetFromFile(ISOPath, false);
                sw.Stop();

                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;
            })
            {
                CurrentCulture   = CultureInfo.CurrentCulture,
                CurrentUICulture = CultureInfo.CurrentUICulture
            };
            th.Start();
        }