private void buttonMakeHome_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_location)) { KeePassRPCPlugin._host.Database.CustomData.Set("KeePassRPC.KeeFox.rootUUID", KeePassLib.Utility.MemUtil.ByteArrayToHexString(_group.Uuid.UuidBytes)); } 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 = KeeFoxHomeStatus.Unknown; UpdateStatus(); KeePassRPCPlugin._host.MainWindow.UpdateUI(false, null, true, null, true, null, true); }
private void comboBoxLocation_SelectedIndexChanged(object sender, EventArgs e) { string selected = (string)comboBoxLocation.SelectedItem; if (selected == "Location manager...") { // launch location manager LocationManager lm = new LocationManager(KeePassRPCPlugin); if (lm.ShowDialog() == DialogResult.OK) { UpdateLocations(); } } else if (selected == "Anywhere") { // use default home group _location = ""; _status = KeeFoxHomeStatus.Unknown; UpdateStatus(); } else { // use custom home group for this location if it's been set //string klrgs = KeePassRPCPlugin._host.CustomConfig.GetString("KeePassRPC.knownLocations." + selected + ".RootGroups",""); //if (!string.IsNullOrEmpty(klrgs)) //{ // string[] rootGroups = new string[0]; // rootGroups = klrgs.Split(','); //foreach (string rootGroupId in rootGroups) //{ // PwUuid pwuuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(rootGroupId)); // PwGroup matchedGroup = KeePassRPCPlugin._host.Database.RootGroup.Uuid == pwuuid ? KeePassRPCPlugin._host.Database.RootGroup : KeePassRPCPlugin._host.Database.RootGroup.FindGroup(pwuuid, true); // if (matchedGroup == null) // continue; _location = selected; // update our idea of what the root group is so we can then refresh the dialog details and update the required behaviour if the user clicks the "make root" button _status = KeeFoxHomeStatus.Unknown; UpdateStatus(); //host.Database.CustomData.Set("KeePassRPC.KeeFox.rootUUID", rootGroupId); //host.MainWindow.UpdateUI(false, null, true, null, true, null, true); //break; // } // } } }
private void buttonMakeHome_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_location)) { KeePassRPCPlugin._host.Database.CustomData.Set("KeePassRPC.KeeFox.rootUUID", KeePassLib.Utility.MemUtil.ByteArrayToHexString(_group.Uuid.UuidBytes)); } 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 = KeeFoxHomeStatus.Unknown; UpdateStatus(); KeePassRPCPlugin._host.MainWindow.UpdateUI(false, null, true, null, true, null, true); }
private void comboBoxLocation_SelectedIndexChanged(object sender, EventArgs e) { string selected = (string)comboBoxLocation.SelectedItem; if (selected == "Location manager...") { // launch location manager LocationManager lm = new LocationManager(KeePassRPCPlugin); if (lm.ShowDialog() == DialogResult.OK) UpdateLocations(); } else if (selected == "Anywhere") { // use default home group _location = ""; _status = KeeFoxHomeStatus.Unknown; UpdateStatus(); } else { // use custom home group for this location if it's been set //string klrgs = KeePassRPCPlugin._host.CustomConfig.GetString("KeePassRPC.knownLocations." + selected + ".RootGroups",""); //if (!string.IsNullOrEmpty(klrgs)) //{ // string[] rootGroups = new string[0]; // rootGroups = klrgs.Split(','); //foreach (string rootGroupId in rootGroups) //{ // PwUuid pwuuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(rootGroupId)); // PwGroup matchedGroup = KeePassRPCPlugin._host.Database.RootGroup.Uuid == pwuuid ? KeePassRPCPlugin._host.Database.RootGroup : KeePassRPCPlugin._host.Database.RootGroup.FindGroup(pwuuid, true); // if (matchedGroup == null) // continue; _location = selected; // update our idea of what the root group is so we can then refresh the dialog details and update the required behaviour if the user clicks the "make root" button _status = KeeFoxHomeStatus.Unknown; UpdateStatus(); //host.Database.CustomData.Set("KeePassRPC.KeeFox.rootUUID", rootGroupId); //host.MainWindow.UpdateUI(false, null, true, null, true, null, true); //break; // } // } } }