Example #1
0
File: Main.cs Project: Dr1N/Regedit
        private void cmnAddList_Click(object sender, EventArgs e)
        {
            TreeNode currentNode = this.tvRegistry.SelectedNode;
            if (currentNode == null || currentNode.Parent == null) { return; }

            RegistryKey currentRegKey = currentNode.Tag as RegistryKey;
            if (currentRegKey == null || this.rootRegistry.Values.Contains(currentRegKey)) { return; }

            ValueForm form = new ValueForm();

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    currentRegKey.SetValue(form.ValueName, form.ValueValue, form.ValueType);
                    this.UpdateList(currentRegKey);
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Example #2
0
File: Main.cs Project: Dr1N/Regedit
        private void cmnEditList_Click(object sender, EventArgs e)
        {
            if (this.lvRegistry.SelectedIndices.Count == 0) { return; }

            RegistryKey currentRegKey = this.tvRegistry.SelectedNode.Tag as RegistryKey;
            if (currentRegKey == null) { return; }

            string name = lvRegistry.SelectedItems[0].Text;
            RegistryValueKind type = currentRegKey.GetValueKind(name);
            object value = currentRegKey.GetValue(name);

            ValueForm form = new ValueForm(name, type, value);
            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                currentRegKey.SetValue(form.ValueName, form.ValueValue, form.ValueType);
                this.UpdateList(currentRegKey);
            }
        }