private void toolStripEditEntryValue_Click(object sender, EventArgs e) { try { if (dataGridViewRegistry.SelectedCells.Count == 0) { return; } DataGridViewRow row = dataGridViewRegistry.Rows[dataGridViewRegistry.SelectedCells[0].RowIndex]; UtilsRegistryEntry entry = row.Tag as UtilsRegistryEntry; switch (entry.ValueKind) { case RegistryValueKind.ExpandString: case RegistryValueKind.MultiString: case RegistryValueKind.String: case RegistryValueKind.Unknown: ChangeStringDialog stringDialog = new ChangeStringDialog(entry.Name, entry.Value as string, _currentLanguageID); if (DialogResult.OK == stringDialog.ShowDialog(this)) { entry.Value = stringDialog.EntryValue; row.Cells[3].Value = stringDialog.EntryValue; } break; case RegistryValueKind.Binary: ChangeBinaryDialog binaryDialog = new ChangeBinaryDialog(entry.Name, (entry.Value as byte[]), _currentLanguageID); if (DialogResult.OK == binaryDialog.ShowDialog(this)) { entry.Value = binaryDialog.Bytes; row.Cells[3].Value = entry.GetValue(); } break; case RegistryValueKind.DWord: case RegistryValueKind.QWord: ChangeDWordDialog dwordDialog = new ChangeDWordDialog(entry.Name, entry.Value, _currentLanguageID); if (DialogResult.OK == dwordDialog.ShowDialog(this)) { entry.Value = dwordDialog.EntryValue; row.Cells[3].Value = entry.GetValue(); } break; default: throw new ArgumentException(entry.ValueKind.ToString() + " is out of range."); } } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void toolStripEditEntryValue_Click(object sender, EventArgs e) { try { if (dataGridViewRegistry.SelectedCells.Count == 0) return; DataGridViewRow row = dataGridViewRegistry.Rows[dataGridViewRegistry.SelectedCells[0].RowIndex]; UtilsRegistryEntry entry = row.Tag as UtilsRegistryEntry; switch (entry.ValueKind) { case RegistryValueKind.ExpandString: case RegistryValueKind.MultiString: case RegistryValueKind.String: case RegistryValueKind.Unknown: ChangeStringDialog stringDialog = new ChangeStringDialog(entry.Name, entry.Value as string, _currentLanguageID); if (DialogResult.OK == stringDialog.ShowDialog(this)) { entry.Value = stringDialog.EntryValue; row.Cells[3].Value = stringDialog.EntryValue; } break; case RegistryValueKind.Binary: ChangeBinaryDialog binaryDialog = new ChangeBinaryDialog(entry.Name, (entry.Value as byte[]), _currentLanguageID); if (DialogResult.OK == binaryDialog.ShowDialog(this)) { entry.Value = binaryDialog.Bytes; row.Cells[3].Value = entry.GetValue(); } break; case RegistryValueKind.DWord: case RegistryValueKind.QWord: ChangeDWordDialog dwordDialog = new ChangeDWordDialog(entry.Name, entry.Value, _currentLanguageID); if (DialogResult.OK == dwordDialog.ShowDialog(this)) { entry.Value = dwordDialog.EntryValue; row.Cells[3].Value = entry.GetValue(); } break; default: throw new ArgumentException(entry.ValueKind.ToString() + " is out of range."); } } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }