private void addUser_Click(object sender, EventArgs e) { for (; ;) { InputDlg frm = new InputDlg(); Globals.inputType = "userid"; frm.ShowDialog(); if (frm.DialogResult == DialogResult.Cancel) { break; } if (usersList.Any(i => i.Key == Globals.inputResult)) { MessageBox.Show($"This user already has the role {usersList.First(i => i.Key == Globals.inputResult).Value}"); break; } if (!Globals.inputResult.Contains("@discord") && !Globals.inputResult.Contains("@steam") && !Globals.inputResult.Contains("@northwood")) { MessageBox.Show($"You didnt include a discriminator. Please add either @steam @discord or @northwood at the end of the ID depending on the ID type. Eg. 76561197960287930@steam"); break; } if (Globals.inputResult.Contains("@steam") && getSteamInfo(Globals.inputResult.Split('@')[0]) == null) { MessageBox.Show($"That SteamID doesnt exist. Please try again."); continue; } usersList.Add(Globals.inputResult, (string)assignmentGroupsCombo.SelectedItem); Users.Items.Add(Globals.inputResult); Users.SelectedItem = Globals.inputResult; break; } }
private void Groups_DoubleClick(object sender, EventArgs e) { ListBox listBox = sender as ListBox; int index = listBox.IndexFromPoint(((MouseEventArgs)e).Location); if (index != ListBox.NoMatches) { InputDlg frm = new InputDlg(); Globals.inputResult = (string)listBox.SelectedItem; Globals.inputType = "role"; frm.ShowDialog(); if (frm.DialogResult == DialogResult.Cancel) { return; } if (groupList.Any(i => i.name == Globals.inputResult)) { MessageBox.Show("A rank with that name already exists. Please choose a different name"); Groups_DoubleClick(listBox, null); return; } foreach (KeyValuePair <string, List <string> > perm in permissionsDict) { if (perm.Value.Contains(listBox.SelectedItem)) { perm.Value.Remove((string)listBox.SelectedItem); perm.Value.Add(Globals.inputResult); } } groupNameList.Remove(groupNameList.First(i => i == (string)listBox.SelectedItem)); groupNameList.Add(Globals.inputResult); groupList[groupList.IndexOf(groupList.First(i => i.name == (string)listBox.SelectedItem))].name = Globals.inputResult; Groups.Items[listBox.SelectedIndex] = Globals.inputResult; } }
private void enableSteamInfo_Click(object sender, EventArgs e) { InputDlg frm = new InputDlg(); Globals.inputType = "steamAPIKey"; frm.ShowDialog(); if (frm.DialogResult == DialogResult.Cancel) { return; } if (getSteamInfo("76561197960287930", Globals.inputResult) == null) { MessageBox.Show($"The SteamAPI key you entered is invalid. Please try again."); enableSteamInfo_Click(frm, null); return; } File.WriteAllText("steamapikey", Globals.inputResult); steamApiKey = Globals.inputResult; enableSteamInfo.Hide(); showSteamInfoCheckBox.Show(); showSteamInfoCheckBox.Checked = true; }