Exemplo n.º 1
0
        private void comboBoxLocation_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selected = (string)comboBoxLocation.SelectedItem;

            if (selected == "Location manager...")
            {
                // launch location manager
                using (LocationManager lm = new LocationManager(KeePassRPCPlugin))
                {
                    if (lm.ShowDialog() == DialogResult.OK)
                    {
                        UpdateLocations();
                    }
                }
            }
            else if (selected == "Anywhere")
            {
                // use default home group
                _location = "";
                _status   = KeeHomeStatus.Unknown;
                UpdateStatus();
            }
            else
            {
                _location = selected;
                _status   = KeeHomeStatus.Unknown;
                UpdateStatus();
            }
        }
Exemplo n.º 2
0
        private void buttonMakeHome_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(_location))
            {
                var conf = KeePassRPCPlugin._host.Database.GetKPRPCConfig();
                conf.RootUUID = KeePassLib.Utility.MemUtil.ByteArrayToHexString(_group.Uuid.UuidBytes);
                KeePassRPCPlugin._host.Database.SetKPRPCConfig(conf);
            }
            else
            {
                // set the root group for a particular location
                string currentLocationRoots = KeePassRPCPlugin._host.CustomConfig.GetString("KeePassRPC.knownLocations." + _location + ".RootGroups", "");

                currentLocationRoots = CleanUpLocationRootGroups(currentLocationRoots);

                if (currentLocationRoots.Length > 0)
                {
                    currentLocationRoots += ",";
                }
                currentLocationRoots += KeePassLib.Utility.MemUtil.ByteArrayToHexString(_group.Uuid.UuidBytes);

                KeePassRPCPlugin._host.CustomConfig.SetString("KeePassRPC.knownLocations." + _location + ".RootGroups",
                                                              currentLocationRoots);
                KeePassRPCPlugin._host.MainWindow.Invoke((MethodInvoker) delegate { KeePassRPCPlugin._host.MainWindow.SaveConfig(); });
            }

            _status = KeeHomeStatus.Unknown;
            UpdateStatus();
            KeePassRPCPlugin._host.MainWindow.UpdateUI(false, null, true, null, true, null, true);
        }