public UtilsRegistryKey this[string name] { get { RegistryKey key = _parent.Open(); UtilsRegistryKey newKey = new UtilsRegistryKey(_parent.Root, key, _parent.Path + "\\" + name); key.Close(); return(newKey); } }
public UtilsRegistryKey this[string name] { get { RegistryKey key = _parent.Open(); UtilsRegistryKey newKey = new UtilsRegistryKey(_parent.Root, key, _parent.Path + "\\" + name); key.Close(); return newKey; } }
internal UtilsRegistryEntry(UtilsRegistryKey parent, string valueName, UtilsRegistryEntryType type) { _parent = parent; _valueName = valueName; _type = type; }
internal UtilsRegistryEntry(UtilsRegistryKey parent, string valueName) { _parent = parent; _valueName = valueName; _type = UtilsRegistryEntryType.Normal; }
private void toolStripCreateDWORDEntry_Click(object sender, EventArgs e) { try { string fullPath = GetFullNodePath(treeViewRegistry.SelectedNode); UtilsRegistryKey key = new UtilsRegistryKey(GetRegistry(treeViewRegistry.SelectedNode), fullPath); UtilsRegistryEntry entry = key.Keys.Add(RegistryValueKind.DWord, 0); dataGridViewRegistry.Rows.Add(); DataGridViewRow row = dataGridViewRegistry.Rows[dataGridViewRegistry.Rows.Count - 1]; Image typeImage = GetValueKindImage(entry.ValueKind); row.Cells[0].Value = typeImage; row.Cells[1].Value = entry.Name; row.Cells[2].Value = entry.ValueKind.ToString(); row.Cells[3].Value = entry.GetValue(); row.Tag = entry; } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void toolStripKeyCreate_Click(object sender, EventArgs e) { try { string fullPath = GetFullNodePath(treeViewRegistry.SelectedNode); UtilsRegistryKey key = new UtilsRegistryKey(GetRegistry(treeViewRegistry.SelectedNode), fullPath); key.CreateNewSubKey(); buttonRefresh_Click(this, new EventArgs()); } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void toolStripKeyDelete_Click(object sender, EventArgs e) { try { if (0 == treeViewRegistry.SelectedNodes.Count) return; string[] fullPathSelectedNodes = GetNodePaths(treeViewRegistry.SelectedNodes); TreeNode parentNode = null; if( (null != treeViewRegistry.SelectedNode.PrevNode) && (treeViewRegistry.SelectedNodes.Count == 1)) parentNode = treeViewRegistry.SelectedNode.PrevNode; else parentNode = treeViewRegistry.SelectedNode.Parent; if (checkBoxDeleteQuestion.Checked) { string nodeNames = GetNodeNames(treeViewRegistry.SelectedNodes); string message = string.Format("Möchten Sie den Schlüssel löschen?{1}{1}{0}", nodeNames, Environment.NewLine); DialogResult dr = MessageBox.Show(message, "Löschen bestätigen", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) return; } UtilsRegistry registryRoot = GetRegistry(treeViewRegistry.SelectedNode); foreach (string fullPath in fullPathSelectedNodes) { UtilsRegistryKey key = new UtilsRegistryKey(registryRoot, fullPath); key.Delete(); } treeViewRegistry.SelectedNode = parentNode; buttonRefresh_Click(this, new EventArgs()); } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void treeViewRegistry_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { try { string fullPath = GetFullNodePath(treeViewRegistry.SelectedNode); UtilsRegistryKey key = new UtilsRegistryKey(GetRegistry(treeViewRegistry.SelectedNode), fullPath); key.Name = e.Label; treeViewRegistry.LabelEdit = false; } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void treeViewRegistry_AfterSelect(object sender, TreeViewEventArgs e) { try { TreeNode rootNode = GetRootNode(e.Node); UtilsRegistry regRoot = rootNode.Tag as UtilsRegistry; if ((regRoot.HiveKey == Registry.LocalMachine) && (!_userIsAdmin)) treeViewRegistry.ContextMenuStrip = contextMenuStripNoAdmin; else treeViewRegistry.ContextMenuStrip = contextMenuStripKeys; toolStripKeyEdit.Enabled = (treeViewRegistry.SelectedNode != null) && (treeViewRegistry.SelectedNode.Parent != null); toolStripKeyDelete.Enabled = (treeViewRegistry.SelectedNode != null) && (treeViewRegistry.SelectedNode.Parent != null); dataGridViewRegistry.Rows.Clear(); if (null == e.Node.Tag) { labelCurrentPath.Text = e.Node.Text; return; } string fullNodePath = GetFullNodePath(treeViewRegistry.SelectedNode); UtilsRegistryKey key = new UtilsRegistryKey(GetRegistry(e.Node), fullNodePath); bool foundDefault = false; foreach (UtilsRegistryEntry item in key.Entries) { if (item.Type == UtilsRegistryEntryType.Default) foundDefault = true; string name = item.Name; string valueType = item.ValueKind.ToString(); object value = item.GetValue(); Image typeImage = GetValueKindImage(item.ValueKind); dataGridViewRegistry.Rows.Add(typeImage, name, valueType, value); DataGridViewRow newRow = dataGridViewRegistry.Rows[dataGridViewRegistry.Rows.Count - 1]; newRow.Tag = item; } if (!foundDefault) { UtilsRegistryEntry fakedKey = key.Entries.FakedDefaultKey; string name = fakedKey.Name; string valueType = fakedKey.ValueKind.ToString(); object value = fakedKey.GetValue(); Image typeImage = GetValueKindImage(fakedKey.ValueKind); dataGridViewRegistry.Rows.Insert(0, typeImage, name, valueType, value); DataGridViewRow newRow = dataGridViewRegistry.Rows[0]; newRow.Tag = fakedKey; } labelCurrentPath.Text = key.Path; } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void treeViewRegistry_BeforeExpand(object sender, TreeViewCancelEventArgs e) { try { if ((e.Node.Nodes.Count > 0) && ("#stub" == e.Node.Nodes[0].Text)) { e.Node.Nodes.Clear(); string fullPath = GetFullNodePath(e.Node); UtilsRegistryKey key = new UtilsRegistryKey(GetRegistry(e.Node), fullPath); ShowRegNodeChilds(key, e.Node); } else if (null != e.Node.Tag) { e.Node.Nodes.Clear(); string fullPath = GetFullNodePath(e.Node); UtilsRegistryKey key = new UtilsRegistryKey(GetRegistry(e.Node), fullPath); ShowRegNodeChilds(key, e.Node); } } catch (Exception exception) { ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID); errorForm.ShowDialog(this); } }
private void ShowRegNode(UtilsRegistryKey key, TreeNode node) { node = node.Nodes.Add(key.Name); node.Tag = true; if(key.Keys.Count > 0) node.Nodes.Add("#stub"); }
private void ShowRegNodeChilds(UtilsRegistryKey key, TreeNode node) { foreach (UtilsRegistryKey subKey in key.Keys) ShowRegNode(subKey,node); }
internal UtilsRegistryKeys(UtilsRegistryKey parent) { _parent = parent; }
internal UtilsRegistryEntries(UtilsRegistryKey parent) { _parent = parent; }