Exemple #1
0
        private void button_parCreate_Click(object sender, EventArgs e)
        {
            Data.newParName  = textBox_parName.Text;
            Data.newParType  = (RegistryValueKind)Enum.Parse(typeof(Reg.RegistryValueKindNative), comboBox_parData.SelectedItem.ToString());
            Data.newParValue = textBox_parValue.Text;

            RegistryKey selRegKeyOpened = Reg.GetRegistryKeyByName(Data.selectedNode.Parent.Text, Data.regKeysList).OpenSubKey(Data.selectedNode.Text);

            selRegKeyOpened.SetValue(Data.newParName, Data.newParValue, Data.newParType);

            this.Close();
        }
Exemple #2
0
        private void parameterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Data.selectedNode = treeView_registryKeys.SelectedNode;

            RegistryKey currentRegKey = Reg.GetRegistryKeyByName(Data.selectedNode.Text, Data.regKeysList);

            if (currentRegKey != null)
            {
                parCreationForm parCreation = new parCreationForm();

                parCreation.ShowDialog();
            }
            else
            {
                MessageBox.Show("It's not possible to create new parameters here");
            }
        }
Exemple #3
0
        private void treeView_registryKeys_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // showing selected key path

            TreeNode tempNode = treeView_registryKeys.SelectedNode;

            path.Clear();

            for (; ;)
            {
                path.Add(tempNode.Text);

                if (tempNode.Parent == null)
                {
                    break;
                }
                else
                {
                    tempNode = tempNode.Parent;
                }
            }

            textbox_path_str = "";

            path.Reverse();

            foreach (string tn in path)
            {
                textbox_path_str += tn + @"\";
            }

            textBox_path.Text = textbox_path_str;

            // showing name, type and value of selected key

            listView_regParData.Items.Clear();
            RegistryValueKind parType;
            object            parValue;
            String            parValueString;

            RegistryKey currentRegKey = Reg.GetRegistryKeyByName(treeView_registryKeys.SelectedNode.Text, Data.regKeysList);

            if (currentRegKey != null)
            {
                try
                {
                    foreach (string parName in currentRegKey.GetValueNames().OrderBy(x => x))
                    {
                        parValue = currentRegKey.GetValue(parName);
                        parType  = currentRegKey.GetValueKind(parName);

                        parValueString = (parType == RegistryValueKind.DWord) ? $"0x{((int)parValue).ToString("X2").ToLower().PadLeft(8, '0')} ({(uint)(int)parValue})" : parValue.ToString();

                        var parData = new string[] { parName, ((RegistryValueKindNative)parType).ToString(), parValueString };

                        var lvi = new ListViewItem(parData);
                        listView_regParData.Items.Add(lvi);
                    }
                }
                catch { }
            }
        }