Beispiel #1
0
        public void AddImage(ImageLine i)
        {
            Images.Add(i);

            if (!Categories.Contains(i.Category))
            {
                Categories.Add(i.Category);
            }
        }
Beispiel #2
0
        private void btnCustomEntry_Click(object sender, EventArgs e)
        {
            var entryfrm = new CustomEntryFrm();

            if (entryfrm.ShowDialog(this) == DialogResult.OK)
            {
                var im = new ImageLine(Path.GetFileNameWithoutExtension(entryfrm.FilePath), entryfrm.FilePath, "", "",
                                       "", entryfrm.SelectedType);
                CurImages.Add(im);
                SetSize();
                lvIsos.Rows.Add(im.Name, Program.GetFileSizeString(entryfrm.FilePath), "", "", entryfrm.FilePath);
            }
        }
Beispiel #3
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);
        }
Beispiel #4
0
        private void lvIsos_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (lvIsos.SelectedRows.Count != 1)
            {
                return;
            }

            var newname = lvIsos.SelectedRows[0].Cells[0].Value?.ToString() ?? "";
            var newcat  = lvIsos.SelectedRows[0].Cells[2].Value?.ToString() ?? "";
            var newdesc = lvIsos.SelectedRows[0].Cells[3].Value?.ToString() ?? "";

            var ind =
                CurImages.IndexOf(CurImages.Single(x => x.FilePath == lvIsos.SelectedRows[0].Cells[4].Value.ToString()));
            var nw = new ImageLine(newname, lvIsos.SelectedRows[0].Cells[4].Value.ToString(), newdesc, newcat);

            CurImages.RemoveAt(ind);
            CurImages.Insert(ind, nw);
        }
Beispiel #5
0
        private void lvIsos_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (lvIsos.SelectedRows.Count != 1)
                return;

            var newname = lvIsos.SelectedRows[0].Cells[0].Value?.ToString() ?? "";
            var newcat = lvIsos.SelectedRows[0].Cells[2].Value?.ToString() ?? "";
            var newdesc = lvIsos.SelectedRows[0].Cells[3].Value?.ToString() ?? "";

            var ind =
                CurImages.IndexOf(CurImages.Single(x => x.FilePath == lvIsos.SelectedRows[0].Cells[4].Value.ToString()));
            var nw = new ImageLine(newname, lvIsos.SelectedRows[0].Cells[4].Value.ToString(), newdesc, newcat);
            CurImages.RemoveAt(ind);
            CurImages.Insert(ind, nw);
        }
Beispiel #6
0
 private void btnCustomEntry_Click(object sender, EventArgs e)
 {
     var entryfrm = new CustomEntryFrm();
     if (entryfrm.ShowDialog(this) == DialogResult.OK)
     {
         var im = new ImageLine(Path.GetFileNameWithoutExtension(entryfrm.FilePath), entryfrm.FilePath, "", "",
             "", entryfrm.SelectedType);
         CurImages.Add(im);
         SetSize();
         lvIsos.Rows.Add(im.Name, Program.GetFileSizeString(entryfrm.FilePath), "", "", entryfrm.FilePath);
     }
 }
Beispiel #7
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);
        }