Esempio n. 1
0
 public void removeRegistryItem()
 {
     try
     {
         rm.DeleteValue(RegistryManager.FILES_KEY_NAME, file_path);
     }
     catch (ArgumentException)
     {
         // if the value does not exist in registry
     }
 }
Esempio n. 2
0
        private void chkClearRunHistory_CheckedChanged(object sender, EventArgs e)
        {
            string key = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU";

            if (chkClearRunHistory.Checked)
            {
                RegistryValue[] values = RegistryManager.GetKeyValues(key);
                foreach (RegistryValue item in values)
                {
                    RegistryManager.DeleteValue($"{key}\\{item.Name}");
                }
            }
        }
Esempio n. 3
0
        private void gridDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show($"آیا برای حذف {gridValues.SelectedRows[0].Cells[0].Value} اطمینان دارید؟", "حذف مقدار", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (!RegistryManager.GetKeyValues(treeViewRegistery.SelectedNode.FullPath).Any(item => item.Name == gridValues.SelectedRows[0].Cells[0].Value.ToString()))
                {
                    gridValues.Rows.Remove(gridValues.SelectedRows[0]);
                    MessageBox.Show("مقداری با این نام یافت نشد.", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                RegistryManager.DeleteValue($"{treeViewRegistery.SelectedNode.FullPath}\\{gridValues.SelectedRows[0].Cells[0].Value}");
                BindValues(treeViewRegistery.SelectedNode);
            }
        }
Esempio n. 4
0
        private void chkClockSeconds_CheckedChanged(object sender, EventArgs e)
        {
            string key = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced";

            if (chkClockSeconds.Checked)
            {
                RegistryManager.AddValue(key, new RegistryValue
                {
                    Name      = "ShowSecondsInSystemClock",
                    Value     = 1,
                    ValueKind = RegistryValueKind.DWord
                });
            }
            else
            {
                RegistryManager.DeleteValue($"{key}\\ShowSecondsInSystemClock");
            }
        }
Esempio n. 5
0
        private void chkFloatingSearch_CheckedChanged(object sender, EventArgs e)
        {
            string parent = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search";

            if (chkFloatingSearch.Checked)
            {
                RegistryManager.AddValue(parent, new RegistryValue
                {
                    Name      = "ImmersiveSearch",
                    Value     = 1,
                    ValueKind = RegistryValueKind.DWord
                });
            }
            else
            {
                RegistryManager.DeleteValue($"{parent}\\ImmersiveSearch");
            }
        }
Esempio n. 6
0
        private void chkShortcutArrows_CheckedChanged(object sender, EventArgs e)
        {
            string key = @"HKEY_CLASSES_ROOT\lnkfile";

            if (chkShortcutArrows.Checked)
            {
                RegistryManager.DeleteValue($"{key}\\IsShortcut");
            }
            else
            {
                RegistryManager.AddValue(key, new RegistryValue
                {
                    Name      = "IsShortcut",
                    Value     = "",
                    ValueKind = RegistryValueKind.String
                });
            }
        }
Esempio n. 7
0
        private void chkHideDrives_CheckedChanged(object sender, EventArgs e)
        {
            string key = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer";

            if (chkHideDrives.Checked)
            {
                RegistryManager.AddValue(key, new RegistryValue()
                {
                    Name      = "NoDrives",
                    Value     = 67108863,
                    ValueKind = RegistryValueKind.DWord
                });
            }
            else
            {
                RegistryManager.DeleteValue($"{key}\\NoDrives");
            }
        }