Esempio n. 1
0
        private void showMissingPicsAuditToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!showMissingPicsAuditToolStripMenuItem.Checked)
                {
                    ColumnMissingPics.Visible = false;
                    return;
                }

                if (comboBoxPlatform.Text == "" || comboBoxPlatform.Text == "none")
                {
                    FormCustomMessage.ShowError("Select a platform first");
                    return;
                }

                var boxpics      = RomFunctions.GetPics(comboBoxPlatform.Text, PicType.BoxArt, false, true);
                var titlepics    = RomFunctions.GetPics(comboBoxPlatform.Text, PicType.Title, false, true);
                var gameplaypics = RomFunctions.GetPics(comboBoxPlatform.Text, PicType.Gameplay, false, true);

                dataGridView.SuspendLayout();

                foreach (DataGridViewRow row in dataGridView.Rows)
                {
                    Rom rom = (Rom)row.Tag;

                    bool boxExists      = boxpics.Any(x => x.ToLower() == rom.FileNameNoExt.ToLower());
                    bool titleExists    = titlepics.Any(x => x.ToLower() == rom.FileNameNoExt.ToLower());
                    bool gameplayExists = gameplaypics.Any(x => x.ToLower() == rom.FileNameNoExt.ToLower());

                    int missing = 0;

                    if (!boxExists)
                    {
                        missing++;
                    }

                    if (!titleExists)
                    {
                        missing++;
                    }

                    if (!gameplayExists)
                    {
                        missing++;
                    }

                    if (missing == 0)
                    {
                        row.Cells[ColumnMissingPics.Name].Style.BackColor = Color.Green;
                        row.Cells[ColumnMissingPics.Name].Value           = "ALL";
                    }
                    else if (missing == 1)
                    {
                        row.Cells[ColumnMissingPics.Name].Style.BackColor = Color.Yellow;
                        row.Cells[ColumnMissingPics.Name].Value           = "Missing 1";
                    }
                    else if (missing == 2)
                    {
                        row.Cells[ColumnMissingPics.Name].Style.BackColor = Color.Orange;
                        row.Cells[ColumnMissingPics.Name].Value           = "Missing 2";
                    }
                    else if (missing == 3)
                    {
                        row.Cells[ColumnMissingPics.Name].Style.BackColor = Color.Red;
                        row.Cells[ColumnMissingPics.Name].Value           = "Missing 3";
                    }
                }

                dataGridView.ResumeLayout();

                ColumnMissingPics.Visible = showMissingPicsAuditToolStripMenuItem.Checked;

                if (updating)
                {
                    return;
                }
            }
            catch (OperationCanceledException ioex)
            {
                return;
            }
            catch (Exception ex)
            {
                FormCustomMessage.ShowError(ex.Message);
            }
        }