private void copyRowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int row = -1;

            if (dataGridView1.SelectedCells.Count > 0)
            {
                row = dataGridView1.SelectedCells[0].RowIndex;
            }
            else if (dataGridView1.SelectedRows.Count > 0)
            {
                row = dataGridView1.SelectedRows[0].Index;
            }
            else
            {
                return;
            }

            clipBrd = new List <ClibBrd>();
            for (int c = 0; c < dataGridView1.Columns.Count; c++)
            {
                if (dataGridView1.Columns[c].Name != "id" && dataGridView1.Columns[c].Name != "UsedInOS" && dataGridView1.Columns[c].Name != "OS" && dataGridView1.Columns[c].Name != "Address" && dataGridView1.Rows[row].Cells[c].Value != null)
                {
                    ClibBrd cb = new ClibBrd();
                    cb.Property = dataGridView1.Columns[c].Name;
                    cb.Value    = dataGridView1.Rows[row].Cells[c].Value.ToString();
                    clipBrd.Add(cb);
                }
            }
            dataClipBoard.DataSource = null;
            dataClipBoard.DataSource = clipBrd;
        }
        private void copyValueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            clipBrd = new List <ClibBrd>();
            ClibBrd cb = new ClibBrd();

            cb.Property = dataGridView1.Columns[dataGridView1.SelectedCells[0].ColumnIndex].Name;
            cb.Value    = dataGridView1.SelectedCells[0].Value.ToString();
            clipBrd.Add(cb);
            dataClipBoard.DataSource = null;
            dataClipBoard.DataSource = clipBrd;
        }
        private void copyValuesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int row = -1;

            if (dataGridView1.SelectedCells.Count > 0)
            {
                row = dataGridView1.SelectedCells[0].RowIndex;
            }
            else if (dataGridView1.SelectedRows.Count > 0)
            {
                row = dataGridView1.SelectedRows[0].Index;
            }
            else
            {
                return;
            }

            clipBrd = new List <ClibBrd>();
            frmSelectTableDataProperties fst = new frmSelectTableDataProperties();

            fst.groupBox2.Visible = false;
            int       mmid = Convert.ToInt32(dataGridView1.Rows[row].Cells["id"].Value);
            TableData td   = displayDatas[mmid].td;

            fst.loadProperties(td);
            if (fst.ShowDialog() == DialogResult.OK)
            {
                for (int p = 0; p < fst.chkBoxes.Count; p++)
                {
                    CheckBox chk = fst.chkBoxes[p];
                    if (chk.Checked && chk.Tag != null)
                    {
                        ClibBrd cb = new ClibBrd();
                        cb.Property = chk.Name;
                        cb.Value    = chk.Tag.ToString();
                        clipBrd.Add(cb);
                    }
                }
                dataClipBoard.DataSource = null;
                dataClipBoard.DataSource = clipBrd;
            }
        }
        private void pasteSpecialToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int row = -1;

            if (dataGridView1.SelectedCells.Count > 0)
            {
                row = dataGridView1.SelectedCells[0].RowIndex;
            }
            else if (dataGridView1.SelectedRows.Count > 0)
            {
                row = dataGridView1.SelectedRows[0].Index;
            }
            else
            {
                return;
            }

            int       mmid = Convert.ToInt32(dataGridView1.Rows[row].Cells["id"].Value);
            TableData td   = displayDatas[mmid].td;

            frmSelectTableDataProperties fst = new frmSelectTableDataProperties();

            fst.loadProperties(td);
            for (int c = 0; c < fst.chkBoxes.Count; c++)
            {
                if (fst.chkBoxes[c].Name == "TableName")
                {
                    fst.chkBoxes[c].Checked = true;
                }
                else
                {
                    fst.chkBoxes[c].Checked = false;
                }
            }
            fst.btnOK.Text       = "Next >";
            fst.Text             = "Select table search criteria";
            fst.labelAction.Text = "Select table search criteria";
            if (fst.ShowDialog() != DialogResult.OK)
            {
                fst.Dispose();
                return;
            }
            fst.Dispose();

            List <ClibBrd> myCriteria = new List <ClibBrd>();

            for (int p = 0; p < fst.chkBoxes.Count; p++)
            {
                CheckBox chk = fst.chkBoxes[p];
                if (chk.Checked && chk.Tag != null)
                {
                    ClibBrd cb = new ClibBrd();
                    cb.Property = chk.Name;
                    cb.Value    = chk.Tag.ToString();
                    myCriteria.Add(cb);
                }
            }

            List <TableDataExtended> tdeList = new List <TableDataExtended>();

            for (int tf = 0; tf < tunerFiles.Count; tf++)
            {
                for (int t = 0; t < tunerFiles[tf].tableDatas.Count; t++)
                {
                    bool match = true;
                    Type type  = tunerFiles[tf].tableDatas[t].GetType();
                    for (int mc = 0; mc < myCriteria.Count; mc++)
                    {
                        PropertyInfo prop = type.GetProperty(myCriteria[mc].Property);
                        if (prop.PropertyType == typeof(string))
                        {
                            double percentage = ComputeSimilarity.CalculateSimilarity((string)prop.GetValue(tunerFiles[tf].tableDatas[t], null), myCriteria[mc].Value);
                            if ((percentage * 100) < (double)Properties.Settings.Default.TableEditorMinOtherEquivalency)
                            {
                                match = false;
                                break;
                            }
                            else
                            {
                                Debug.WriteLine((string)prop.GetValue(tunerFiles[tf].tableDatas[t], null) + " <=> " + myCriteria[mc].Value + "; Equivalency: " + (percentage * 100).ToString() + "%");
                            }
                        }
                        else if ((string)prop.GetValue(tunerFiles[tf].tableDatas[t], null).ToString() != myCriteria[mc].Value)
                        {
                            match = false;
                            break;
                        }
                    }
                    if (match)
                    {
                        //This table definition match criteria
                        TableDataExtended tde       = new TableDataExtended();
                        TableData         tabledata = tunerFiles[tf].tableDatas[t];
                        foreach (var tdProp in tabledata.GetType().GetProperties())
                        {
                            Type         tdeType = tde.GetType();
                            PropertyInfo tdeProp = tdeType.GetProperty(tdProp.Name);
                            tdeProp.SetValue(tde, tdProp.GetValue(tabledata, null), null);
                        }
                        tde.id     = (uint)t;
                        tde.fileId = tf;
                        tde.File   = tunerFiles[tf].FileName;
                        tde.Select = true;
                        tdeList.Add(tde);
                    }
                }
            }
            frmSelectMassTarget frmSmt = new frmSelectMassTarget();

            Application.DoEvents();
            frmSmt.loadData(tdeList);
            if (frmSmt.ShowDialog() != DialogResult.OK)
            {
                frmSmt.Dispose();
                return;
            }

            for (int r = 0; r < frmSmt.dataGridView1.Rows.Count; r++)
            {
                if (Convert.ToBoolean(frmSmt.dataGridView1.Rows[r].Cells["Select"].Value) == true)
                {
                    int tf = Convert.ToInt32(frmSmt.dataGridView1.Rows[r].Cells["fileId"].Value);
                    int t  = Convert.ToInt32(frmSmt.dataGridView1.Rows[r].Cells["id"].Value);
                    Logger("Updating table list: " + tunerFiles[tf].FileName);
                    for (int cb = 0; cb < clipBrd.Count; cb++)
                    {
                        TableData    tabledata = tunerFiles[tf].tableDatas[t];
                        Type         tdType    = tabledata.GetType();
                        PropertyInfo tdProp    = tdType.GetProperty(clipBrd[cb].Property);
                        if (tdProp.PropertyType.IsEnum)
                        {
                            tdProp.SetValue(tunerFiles[tf].tableDatas[t], Enum.Parse(tdProp.PropertyType, clipBrd[cb].Value), null);
                        }
                        else
                        {
                            tdProp.SetValue(tunerFiles[tf].tableDatas[t], Convert.ChangeType(clipBrd[cb].Value, tdProp.PropertyType), null);
                        }
                        Logger("Property: " + clipBrd[cb].Property + ", value: " + clipBrd[cb].Value);
                    }
                    modifiedFiles.Add(tf);
                    tunerFiles[tf].Modified = true;
                }
            }
            Logger("Done. (Save files manually)");
        }