Esempio n. 1
0
        private void newStringDataToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dlgNewValue == null)
            {
                dlgNewValue = new RegistryNewValueForm();
            }

            // initialize the dialog:
            dlgNewValue.SetUI(SharedStrings.RegistryView_TitleAddString, string.Empty, string.Empty, RegistryValueKind.String, RegistryValueKind.ExpandString, RegistryValueKind.MultiString, RegistryValueKind.String);

            // add value:
            if (dlgNewValue.ShowDialog() == DialogResult.OK)
            {
                AddNewValue(treeView.SelectedNode, dlgNewValue.RegistryValueName, dlgNewValue.RegistryValueType, dlgNewValue.RegistryValue, true);
            }
        }
Esempio n. 2
0
        private void editToolStripMenu_Click(object sender, EventArgs e)
        {
            RegistryKey key;

            if (listView.SelectedItems != null && listView.SelectedItems.Count > 0)
            {
                if (dlgNewValue == null)
                {
                    dlgNewValue = new RegistryNewValueForm();
                }

                bool close;
                key = GetKey(treeView.SelectedNode, true, out close);
                string valueName = listView.SelectedItems[0].Name;

                if (close)
                {
                    // initialize the dialog:
                    dlgNewValue.SetUI(SharedStrings.RegistryView_TitleEdit, valueName,
                                      key.GetValue(valueName, null, RegistryValueOptions.DoNotExpandEnvironmentNames),
                                      key.GetValueKind(valueName),
                                      RegistryValueKind.Binary, RegistryValueKind.DWord,
                                      RegistryValueKind.ExpandString, RegistryValueKind.MultiString,
                                      RegistryValueKind.QWord, RegistryValueKind.String);

                    // add value:
                    if (dlgNewValue.ShowDialog() == DialogResult.OK)
                    {
                        if (dlgNewValue.RegistryValueName != valueName)
                        {
                            key.DeleteValue(valueName);
                        }

                        AddNewValue(treeView.SelectedNode, dlgNewValue.RegistryValueName, dlgNewValue.RegistryValueType,
                                    dlgNewValue.RegistryValue, true);
                    }

                    key.Close();
                }
            }
        }