當前位置: 首頁>>代碼示例>>C#>>正文


C# RegistryKey.?.SetValue方法代碼示例

本文整理匯總了C#中Microsoft.Win32.RegistryKey.?.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# RegistryKey.?.SetValue方法的具體用法?C# RegistryKey.?.SetValue怎麽用?C# RegistryKey.?.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.Win32.RegistryKey的用法示例。


在下文中一共展示了RegistryKey.?.SetValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Button1Click


//.........這裏部分代碼省略.........
            MainForm.Iconfont = new Font(FontFamily.GenericSansSerif, MainForm.Conf.BigButtons ? 22 : 15, FontStyle.Bold, GraphicsUnit.Pixel);

            MainForm.Conf.TalkMic = "";
            if (ddlTalkMic.Enabled)
            {
                if (ddlTalkMic.SelectedIndex>0)
                    MainForm.Conf.TalkMic = ddlTalkMic.SelectedItem.ToString();
            }

            MainForm.Conf.MinimiseOnClose = chkMinimise.Checked;
            MainForm.Conf.JPEGQuality = (int) numJPEGQuality.Value;
            MainForm.Conf.IPv6Disabled = !chkEnableIPv6.Checked;

            MainForm.SetPriority();

            var ips = rtbAccessList.Text.Trim().Split(',');
            var t = ips.Select(ip => ip.Trim()).Where(ip2 => ip2 != "").Aggregate("", (current, ip2) => current + (ip2 + ","));
            MainForm.Conf.AllowedIPList = t.Trim(',');
            LocalServer.AllowedIPs = null;

            var refs = rtbReferrers.Text.Trim().Split(',');
            var t2 = refs.Select(ip => ip.Trim()).Where(ip2 => ip2 != "").Aggregate("", (current, ip2) => current + (ip2 + ","));
            MainForm.Conf.Referers = t2.Trim(',');
            LocalServer.AllowedReferers = null;

            MainForm.Conf.ShowOverlayControls = chkOverlay.Checked;

            string lang = ((ListItem) ddlLanguage.SelectedItem).Value[0];
            if (lang != MainForm.Conf.Language)
            {
                ReloadResources = true;
                LocRm.Reset();
            }
            MainForm.Conf.Language = lang;
            if (chkStartup.Checked)
            {
                try
                {
                    _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    _rkApp?.SetValue("iSpy", "\"" + Application.ExecutablePath + "\" -silent", RegistryValueKind.String);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    MainForm.LogExceptionToFile(ex);
                }
            }
            else
            {
                try
                {
                    _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    _rkApp?.DeleteValue("iSpy", false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    MainForm.LogExceptionToFile(ex);
                }
            }

            //SetStorageOptions();

            MainForm.ReloadColors();

            if (ddlJoystick.SelectedIndex > 0)
            {
                string nameid = _sticks[ddlJoystick.SelectedIndex - 1];
                MainForm.Conf.Joystick.id = nameid.Split('|')[1];

                MainForm.Conf.Joystick.XAxis = jaxis1.ID;

                MainForm.Conf.Joystick.InvertXAxis = jaxis1.Invert;

                MainForm.Conf.Joystick.YAxis = jaxis2.ID;
                MainForm.Conf.Joystick.InvertYAxis = jaxis2.Invert;

                MainForm.Conf.Joystick.ZAxis = jaxis3.ID;
                MainForm.Conf.Joystick.InvertZAxis = jaxis3.Invert;

                MainForm.Conf.Joystick.Record = jbutton1.ID;
                MainForm.Conf.Joystick.Snapshot = jbutton2.ID;
                MainForm.Conf.Joystick.Talk = jbutton3.ID;
                MainForm.Conf.Joystick.Listen = jbutton4.ID;
                MainForm.Conf.Joystick.Play = jbutton5.ID;
                MainForm.Conf.Joystick.Next = jbutton6.ID;
                MainForm.Conf.Joystick.Previous = jbutton7.ID;
                MainForm.Conf.Joystick.Stop = jbutton8.ID;
                MainForm.Conf.Joystick.MaxMin = jbutton9.ID;
            }
            else
                MainForm.Conf.Joystick.id = "";

            MainForm.Conf.Logging.Enabled = chkEnableLogging.Checked;
            MainForm.Conf.Logging.FileSize = (int)numMaxLogSize.Value;
            MainForm.Conf.Logging.KeepDays = (int)numKeepLogs.Value;

            DialogResult = DialogResult.OK;
            Close();
        }
開發者ID:soitun,項目名稱:iSpy,代碼行數:101,代碼來源:Settings.cs

示例2: SetKey

 public static void SetKey(RegistryKey key, string name, string value)
 {
     key?.SetValue(name, value);
 }
開發者ID:danielchalmers,項目名稱:Windows10BlurryFontFix,代碼行數:4,代碼來源:RegistryHelper.cs


注:本文中的Microsoft.Win32.RegistryKey.?.SetValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。