示例#1
0
        private void frmPreferences_Load(object sender, EventArgs e)
        {
            if (this.cbPlaces.Items.Count == 0)
            {
                this.FillPlaces();
            }

            for (int i = 0; i < this.cbPlaces.Items.Count; i++)
            {
                var place = (Location)this.cbPlaces.Items[i];
                if (place.Name == Program.CurrentLocation.Name)
                {
                    this.cbPlaces.SelectedIndex = i;
                    break;
                }
            }

            this._regKey = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Chashavshavon", true);
            if (this._regKey == null)
            {
                this._regKey = Registry.CurrentUser.OpenSubKey("Software", true).CreateSubKey("Chashavshavon", RegistryKeyPermissionCheck.ReadWriteSubTree);
                this._regKey.SetValue("Entry", "", RegistryValueKind.String);
                this._regKey.SetValue("Straight", "1", RegistryValueKind.String);
            }
            else
            {
                this.cbRequirePassword.Checked = (this._regKey.GetValue("Straight").ToString() == "0");
                string pw = Convert.ToString(this._regKey.GetValue("Entry"));
                if (!string.IsNullOrEmpty(pw))
                {
                    this.txtPassword.Text = GeneralUtils.Decrypt(pw, "kedoshimteeheeyoo");
                }
            }
            this._loading = false;
        }
示例#2
0
        private void btnReload_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Reload();
            this.SetRadioButtons();
            Program.CurrentLocation = Locations.GetPlace(Properties.Settings.Default.LocationName);
            for (int i = 0; i < this.cbPlaces.Items.Count; i++)
            {
                var place = (Location)this.cbPlaces.Items[i];
                if (place.Name == Program.CurrentLocation.Name)
                {
                    this.cbPlaces.SelectedIndex = i;
                    break;
                }
            }

            this._regKey = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Chashavshavon", true);
            this.cbRequirePassword.Checked = (this._regKey.GetValue("Straight").ToString() == "0");
            string pw = Convert.ToString(this._regKey.GetValue("Entry"));

            if (!string.IsNullOrEmpty(pw))
            {
                this.txtPassword.Text = GeneralUtils.Decrypt(pw, "kedoshimteeheeyoo");
            }
        }