Beispiel #1
0
 private void treeDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (treeViewRegistery.SelectedNode.Parent == null)
         {
             MessageBox.Show("کلید روت نمیتواند حذف شود.", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         DialogResult result = MessageBox.Show($"آیا برای حذف {treeViewRegistery.SelectedNode.FullPath} اطمینان دارید؟", "حذف کلید", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             if (RegistryManager.GetRegistryKey(treeViewRegistery.SelectedNode.FullPath) == null)
             {
                 treeViewRegistery.Nodes.Remove(treeViewRegistery.SelectedNode);
                 MessageBox.Show("کلیدی با این نام یافت نشد.", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             RegistryManager.DeleteKey(treeViewRegistery.SelectedNode.Parent.FullPath, treeViewRegistery.SelectedNode.Text);
             thLoadKeys = new Thread(LoadKeys);
             thLoadKeys.Start();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("نرم افزار قادر به حذف کلید انتخاب شده نیست.", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
        private void chkDisableLockScreen_CheckedChanged(object sender, EventArgs e)
        {
            string parent = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows";

            if (chkDisableLockScreen.Checked)
            {
                RegistryManager.CreateKey(parent, "Personalization");
                RegistryManager.AddValue($"{parent}\\Personalization", new RegistryValue
                {
                    Name      = "NoLockScreen",
                    Value     = 1,
                    ValueKind = RegistryValueKind.DWord
                });
            }
            else
            {
                RegistryManager.DeleteKey(parent, "Personalization");
            }
        }
Beispiel #3
0
        private void chkContextMenuMoveTo_CheckedChanged(object sender, EventArgs e)
        {
            string parent = @"HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers";

            if (chkContextMenuMoveTo.Checked)
            {
                RegistryKey key = RegistryManager.CreateKey(parent, "MoveTo");
                RegistryManager.EditValue(key.Name, "", new RegistryValue()
                {
                    Name      = "",
                    Value     = "{C2FBB631-2971-11D1-A18C-00C04FD75D13}",
                    ValueKind = RegistryValueKind.String
                });
            }
            else
            {
                RegistryManager.DeleteKey(parent, "MoveTo");
            }
        }
Beispiel #4
0
        private void chkRestrictChangingDesktopWallpaper_CheckedChanged(object sender, EventArgs e)
        {
            string parentKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies";

            if (chkRestrictChangingDesktopWallpaper.Checked)
            {
                RegistryKey key           = RegistryManager.CreateKey(parentKey, "System");
                string      lastWallpaper = RegistryManager.GetKeyValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallPaper").Value.ToString();
                RegistryManager.AddValue(key.Name, new RegistryValue()
                {
                    Name      = "WallPaper",
                    Value     = lastWallpaper,
                    ValueKind = RegistryValueKind.String
                });
            }
            else
            {
                RegistryManager.DeleteKey(parentKey, "System");
            }
        }