public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Friends Management Usage: /addfriend playerName"); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (entry.Value.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { AddFriend(new PList.Player(entry.Key, entry.Value), pl); return; } else if (entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { AddFriend(new PList.Player(client.UID, client.Name), pl); return; } if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } } if (list.Count == 1) { pl.MessageFrom(Core.Name, string.Format("No player matches the name {0}. Sorry.", playerName)); return; } pl.MessageFrom(Core.Name, string.Format("{0} player{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "0 - Cancel"); pl.MessageFrom(Core.Name, "Please enter the number matching the player to add as your friend."); Core.friendWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Use " + cyan + "/addfriend \"player\"" + white + " - to add a friend to your friends list."); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (entry.Value.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { AddFriend(new PList.Player(entry.Key, entry.Value), pl); return; } else if (entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { AddFriend(new PList.Player(client.UID, client.Name), pl); return; } if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } } if (list.Count == 1) { pl.MessageFrom(Core.Name, string.Format(yellow + "☢ " + red + "No player online with the name:" + yellow + " {0}", playerName)); return; } pl.MessageFrom(Core.Name, string.Format("☢ " + cyan + "{0} " + white + "{1}", ((list.Count - 1)).ToString(), (((list.Count - 1) == 1) ? "Player was found:" : "Players were found:"))); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("☢ " + cyan + "{0} " + white + "- {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "☢ " + cyan + "0" + white + " - Cancel"); pl.MessageFrom(Core.Name, "☢ " + cyan + "Please enter the number matching the player."); Core.friendWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Whitelist Usage: /addwl playerName"); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (entry.Value.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { Whitelist(new PList.Player(entry.Key, entry.Value), Arguments.argUser); return; } else if (entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (PlayerClient client in PlayerClient.All) { if (client.netUser.displayName.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { Whitelist(new PList.Player(client.netUser.userID, client.netUser.displayName), Arguments.argUser); return; } else if (client.netUser.displayName.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.netUser.userID, client.netUser.displayName); } } } if (list.Count == 1) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + playerName); return; } Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("{0} player{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel"); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player to whitelist."); Core.whiteWaitList[Arguments.argUser.userID] = list; }
static PList ParseList(string code, ref int i, bool top = false) { var list = new PList(); while (i < code.Length) { switch (code[i]) { case ' ': case '\t': case '\n': case '\r': i++; break; case '(': i++; list.Add(ParseList(code, ref i)); break; case ')': i++; return(list); case '-' when code[i + 1] >= '0' && code[i + 1] <= '9':
private void button1_Click(object sender, EventArgs e) { if (!Check()) { MessageBox.Show("Не все поля заполнены"); return; } id = 0; plist.Read(); if (plist.Length == 0) { temp = new Phrase(plist.RemoveSpaces(phrasetextBox.Text), slist[this.getnums()].Year, alist[acomboBox.SelectedIndex], slist[this.getnums()], id); } else { id = plist[plist.Length - 1].Id + 1; temp = new Phrase(plist.RemoveSpaces(phrasetextBox.Text), slist[this.getnums()].Year, alist[acomboBox.SelectedIndex], slist[this.getnums()], id); } plist.Add(temp); DialogResult = DialogResult.OK; plist.Write(); Clear(); Close(); }
private void PList_test() { PList <Para> pps = new PList <Para>(); pps.Add(new Para(Guid.NewGuid()) { ParaName = "pn1", ParaValue = "pv1" }); pps.Add(new Para(Guid.NewGuid()) { ParaName = "pn2", ParaValue = "pv2" }); string pv = pps["pn", true].TryObject <string>(); }
/// <summary> /// Adds the value if it is not null or empty. /// </summary> /// <param name="plist">The list.</param> /// <param name="key">The key.</param> /// <param name="value">The value.</param> public static void AddIfNotNullOrEmpty(this PList plist, string key, string?value) { if (value is null || string.IsNullOrEmpty(value)) { return; } plist.Add(key, value); }
internal void Move() { Point tail = PList[0]; PList.RemoveAt(0); Point head = GetNextPoint(); PList.Add(head); tail.Clear(); head.Draw(); }
/// <summary> /// Adds the string values as dictionaries wrapped in an array. /// </summary> /// <param name="plist">The PList.</param> /// <param name="key">The array key.</param> /// <param name="values">The values.</param> public static void Add(this PList plist, string key, IEnumerable <string> values) { var @array = values.ToPListArray("name"); if (array.Length == 0) { return; } plist.Add(key, array); }
internal bool Eat(Point food) { Point head = GetNextPoint(); if (head.IsHit(food)) { food.Symbol = head.Symbol; PList.Add(food); return(true); } return(false); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Unmute Usage: /unmute playerName"); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (PList.Player muted in Core.muteList.PlayerList) { Logger.LogDebug(string.Format("[UnmuteCommand] muted.DisplayName={0}, playerName={1}", muted.DisplayName, playerName)); if (muted.DisplayName.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { UnmutePlayer(muted, pl); return; } if (muted.DisplayName.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(muted); } } if (list.Count == 1) { pl.MessageFrom(Core.Name, "No player in the mute list matches the name: " + playerName); return; } pl.MessageFrom(Core.Name, string.Format("{0} player{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "0 - Cancel"); pl.MessageFrom(Core.Name, "Please enter the number matching the player to unmute."); Core.unmuteWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Use " + cyan + "/unban \"player\"" + white + " - to unban a specific player."); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (PList.Player banned in Core.blackList.PlayerList) { if (banned.DisplayName.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { UnbanPlayer(banned, pl); return; } if (banned.DisplayName.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(banned); } } if (list.Count == 1) { pl.MessageFrom(Core.Name, yellow + "☢ " + red + "No banned player matches the name: " + yellow + playerName + red + "."); return; } pl.MessageFrom(Core.Name, string.Format("☢ " + cyan + "{0} " + white + "{1}:", ((list.Count - 1)).ToString(), (((list.Count - 1) == 1) ? "Player was found:" : "Players were found:"))); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("☢ " + cyan + "{0} " + white + "- {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "☢ " + cyan + "0" + white + " - Cancel"); pl.MessageFrom(Core.Name, "☢ " + cyan + "Please enter the number matching the player."); Core.unbanWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Unmute Usage: /unmute playerName"); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (PList.Player banned in Core.blackList.PlayerList) { if (banned.DisplayName.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { UnbanPlayer(banned, Arguments.argUser); return; } else if (banned.DisplayName.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(banned); } } if (list.Count == 1) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No banned player matches the name: " + playerName); return; } Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("{0} player{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel"); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player to unban."); Core.unbanWaitList[Arguments.argUser.userID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Kill Usage: /kill playerName"); } PList list = new PList(); list.Add(new PList.Player(0, "Cancel")); foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { KillPlayer(client, pl); return; } if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } if (list.Count == 1) { pl.MessageFrom(Core.Name, "No player matches the name: " + playerName); return; } pl.MessageFrom(Core.Name, string.Format("{0} player{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "0 - Cancel"); pl.MessageFrom(Core.Name, "Please enter the number matching the player you want to murder."); Core.killWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Kill Usage: /kill playerName"); } PList list = new PList(); list.Add(new PList.Player(0, "Cancel")); foreach (PlayerClient client in PlayerClient.All) { if (client.netUser.displayName.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { KillPlayer(client, Arguments.argUser.playerClient); return; } else if (client.netUser.displayName.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.netUser.userID, client.netUser.displayName); } } if (list.Count == 1) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player matches the name: " + playerName); return; } Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("{0} player{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel"); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player you want to murder."); Core.killWaitList[Arguments.argUser.userID] = list; }
public bool Eat(Point food) { Point head = new Point(PList[PList.Count - 1]); if (head.IsHit(food)) { food.Sym = head.Sym; PList.Add(food); return(true); } else { return(false); } }
private void button1_Click(object sender, EventArgs e) // Кнопка добавления фразы(изменения информации о фразе). { if (!Check()) { MessageBox.Show("Не все поля заполнены"); return; } if (add == true) // В случае добавления фразы. { id = 0; if (plist.Length == 0) { temp = new Phrase(plist.RemoveSpaces(phrasetextBox.Text), slist[sourceIndex()].Year, alist[acomboBox.SelectedIndex], slist[sourceIndex()], tcomboBox.Text, id); } else { id = plist[plist.Length - 1].Id + 1; temp = new Phrase(plist.RemoveSpaces(phrasetextBox.Text), slist[sourceIndex()].Year, alist[acomboBox.SelectedIndex], slist[sourceIndex()], tcomboBox.Text, id); } if (plist.Exist(temp)) { MessageBox.Show("Эта фраза уже существует"); return; } plist.Add(temp); DialogResult = DialogResult.OK; plist.Write(); } else // В случае изменения информации о фразе. { plist.Read(); for (int i = 0; i < plist.Length; i++) { if (plist[i].Change) { plist[i].Author = alist[acomboBox.SelectedIndex]; plist[i].Source = slist[sourceIndex()]; plist[i].Theme = tcomboBox.Text; plist[i].Content = plist.RemoveSpaces(phrasetextBox.Text); break; } } plist.Write(); } Clear(); Close(); }
/// <summary> /// Computes traversible path between given points /// </summary> public static T[] GetPath(T start, T goal, IGraphProvider <T> provider) { if (start == null || goal == null) { return(new T[0]); } var open = new PList(); var closed = new PList(); open.Add(new SearchNode <T>(start, 0f, provider.H(start, goal), null)); var result = TraversePath(goal, open, closed, provider); if (result != null) { return(result.RetraceSteps()); } return(new T[0]); }
private static SearchNode <T> TraversePath(T goal, PList open, PList closed, IGraphProvider <T> _provider) { if (open.Count == 0) { return(null); } var current = open.FindBest(); if (current.Node == goal) { return(current); } closed.Add(current); var edges = _provider.GetEdges(current.Node); foreach (var e in edges) { if (closed.HasNode(e.Node)) { continue; } var openChild = open.FindNode(e.Node); if (!openChild) { openChild = new SearchNode <T>(e.Node, e.Cost, _provider.H(e.Node, goal), current); open.Add(openChild); } else { float g = current.G + e.Cost; if ((g + openChild.H) < openChild.F) { openChild.SetParent(current, e.Cost); } } } return(TraversePath(goal, open, closed, _provider)); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Sharing Doors Usage: /unshare playerName"); return; } ShareCommand command = (ShareCommand)ChatCommand.GetCommand("share"); ArrayList shareList = (ArrayList)command.GetSharedDoors()[Arguments.argUser.userID]; if (shareList == null) { pl.MessageFrom(Core.Name, "You aren't sharing doors with anyone."); return; } PList list = new PList(); list.Add(0, "Cancel"); foreach (ulong id in shareList) { if (Core.userCache.ContainsKey(id)) { if (Core.userCache[id].Equals(playerName, StringComparison.OrdinalIgnoreCase)) { UnshareDoors(new PList.Player(id, Core.userCache[id]), pl); } else if (Core.userCache[id].ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(id, Core.userCache[id]); } } else { Fougerite.Player client = Fougerite.Server.GetServer().FindPlayer(id.ToString()); if (client != null) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { UnshareDoors(new PList.Player(id, client.Name), pl); } else if (Core.userCache[id].ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(id, Core.userCache[id]); } } } } if (list.Count == 1) { pl.MessageFrom(Core.Name, string.Format("You aren't sharing doors with {0}.", playerName)); return; } pl.MessageFrom(Core.Name, string.Format("{0} players{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "0 - Cancel"); pl.MessageFrom(Core.Name, "Please enter the number matching the player you won't share doors with."); Core.unshareWaitList[pl.UID] = list; }
//------------------------------------------------------------------------------------- private void btnAddGroups_Click(object sender, EventArgs e) { try { PList<SecurityItem> list = new PList<SecurityItem>(); foreach(SecurityGroup g in pSec.SecurityGroups.Values) { bool need = true; foreach(ACEitem i in ACL) if(i.ACE.SID == g.SID) { need = false; break; } if(need) list.Add(SecurityItem.FromGroup(g)); } SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.Group; frm.CaptionText = "Добавление групп"; frm.VariantsCaption = "Доступные группы"; frm.ChoicesCaption = "Выбранные группы"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
//------------------------------------------------------------------------------------- private void btnAddUsers_Click(object sender, EventArgs e) { try { PList<SecurityItem> list = new PList<SecurityItem>(); foreach(Person u in users) { bool need = true; foreach(ACEitem i in ACL) if(i.ACE.SID == u.OID) { need = false; break; } if(need) list.Add(SecurityItem.FromUser(u)); } SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.Tag = 2; frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.User; frm.CaptionText = "Добавление пользователей"; frm.VariantsCaption = "Доступные пользователи"; frm.ChoicesCaption = "Выбранные пользователи"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
//------------------------------------------------------------------------------------- private void btnSave_Click(object sender, EventArgs e) { try { OID sd = (OID)fdgvACL.Tag; PList<ACE> list = new PList<ACE>(ACL.Count); foreach(ACEitem i in ACL) list.Add(i.ACE); if(pSec.ACEs.ContainsKey(sd)) foreach(ACE i in pSec.ACEs[sd]) if(at != null && at.Contains(i.SID) == false) list.Add(i); ShowProgressWindow(); PulsarQuery q = new PulsarQuery("Security", "SetACEsForSD", new { SetACEsForSD = new Object[] { sd, list } }, PulsarQueryParams.Modify); TaskManager.Run("SetACEsForSD",this,()=> PulsarConnection.Default.Exec(q), new ValuesPair<OID, PList<ACE>>(sd, list)); } catch(Exception Err) { ModalErrorBox.Show(Err, PanelBack); HideProgressWindow(); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.SendClientMessage("<Sintaxis> /share <NombreJugador>"); return; } PList list = new PList(); list.Add(0, "Cancelar"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (entry.Value.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { DoorShare(new PList.Player(entry.Key, entry.Value), pl); return; } if (entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { DoorShare(new PList.Player(client.UID, client.Name), pl); return; } if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } } if (list.Count == 1) { pl.SendClientMessage(string.Format("[color red]<Error>[/color] No se encontraron jugadores con el nombre {0}.", playerName)); return; } pl.SendClientMessage(string.Format("{0} jugador{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "es encontrados" : " encontrado"), playerName)); for (int i = 1; i < list.Count; i++) { pl.SendClientMessage(string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.SendClientMessage("0 - Cancelar"); pl.SendClientMessage("Ingresa el numero del jugador al que deseas compartir tus puertas"); Core.shareWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "[color red]<Sintaxis> /unfriend <NombreJugador>"); return; } FriendsCommand command = (FriendsCommand)ChatCommand.GetCommand("amigos"); FriendList friendsList = (FriendList)command.GetFriendsLists()[pl.UID]; if (friendsList == null) { pl.MessageFrom(Core.Name, "Actualmente no tienes amigos (Pvta ke sad)."); return; } if (friendsList.isFriendWith(playerName)) { friendsList.RemoveFriend(playerName); pl.MessageFrom(Core.Name, "Removiste a " + playerName + " de tu lista de amigos."); if (friendsList.HasFriends()) { command.GetFriendsLists()[pl.UID] = friendsList; } else { command.GetFriendsLists().Remove(pl.UID); } } else { PList list = new PList(); list.Add(0, "Cancel"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (friendsList.isFriendWith(entry.Key) && entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (friendsList.isFriendWith(client.UID) && client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } } if (list.Count == 1) { pl.MessageFrom(Core.Name, string.Format("No eres amigo de {0}.", playerName)); return; } pl.MessageFrom(Core.Name, string.Format("{0} amigo{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s encontrados" : " encontrado"), playerName)); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "0 - Cancelar"); pl.MessageFrom(Core.Name, "Selecciona el amigo al que quieres eliminar."); Core.unfriendWaitList[pl.UID] = list; } }
//------------------------------------------------------------------------------------- /// <summary> /// Добавление пользователей в группу /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChildUserAdd_Click(object sender, EventArgs e) { try { if(fdgvGroups.SelectedRows.Count == 0) return; SecurityGroup cur = (SecurityGroup)((IKeyedValue)fdgvGroups.SelectedRows[0].GetData()).Value; PList<SecurityItem> list = new PList<SecurityItem>(); foreach(Person u in users) if(childsList.FirstOrDefault(x => x.SID == u.OID) == null) list.Add(SecurityItem.FromUser(u)); SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.Tag = 2; frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.User; frm.CaptionText = "Добавление пользователей"; frm.VariantsCaption = "Доступные пользователи"; frm.ChoicesCaption = "Выбранные пользователи"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "Friends Management Usage: /unfriend playerName"); return; } FriendsCommand command = (FriendsCommand)ChatCommand.GetCommand("friends"); FriendList friendsList = (FriendList)command.GetFriendsLists()[pl.UID]; if (friendsList == null) { pl.MessageFrom(Core.Name, "You currently have no friends."); return; } if (friendsList.isFriendWith(playerName)) { friendsList.RemoveFriend(playerName); pl.MessageFrom(Core.Name, "You have removed " + playerName + " from your friends list."); if (friendsList.HasFriends()) { command.GetFriendsLists()[pl.UID] = friendsList; } else { command.GetFriendsLists().Remove(pl.UID); } } else { PList list = new PList(); list.Add(0, "Cancel"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (friendsList.isFriendWith(entry.Key) && entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (friendsList.isFriendWith(client.UID) && client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } } if (list.Count == 1) { pl.MessageFrom(Core.Name, string.Format("You are not friends with {0}.", playerName)); return; } pl.MessageFrom(Core.Name, string.Format("{0} friend{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName)); for (int i = 1; i < list.Count; i++) { pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.MessageFrom(Core.Name, "0 - Cancel"); pl.MessageFrom(Core.Name, "Please enter the number matching the friend to remove."); Core.unfriendWaitList[pl.UID] = list; } }
//------------------------------------------------------------------------------------- /// <summary> /// Инициализирующий конструктор. /// </summary> /// <param name="items">Отображаемые элементы.</param> /// <param name="checkedItems">Выбраные элементы</param> public SimCheckList(IEnumerable items, IEnumerable checkedItems) : this() { if (items == null) throw new ArgumentNullException("items"); list = new PList<ValuesPair<bool, object>>(); foreach (var x in items) { ValuesPair<bool, object> i = new ValuesPair<bool, object>(false, x); i.Value1 = checkedItems != null && checkedItems.Contains(x); list.Add(i); } ListBinder b = new ListBinder(list); fdgv.DataSource = b; }
//------------------------------------------------------------------------------------- /// <summary> /// Добавление дочерних групп /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChildGroupAdd_Click(object sender, EventArgs e) { try { if(fdgvGroups.SelectedRows.Count == 0) return; SecurityGroup cur = (SecurityGroup)((IKeyedValue)fdgvGroups.SelectedRows[0].GetData()).Value; PList<SecurityItem> list = new PList<SecurityItem>(); foreach(SecurityGroup g in psec.SecurityGroups.Values) if(!(g == cur || parentsList.FirstOrDefault(x => x.SID == g.SID) != null || childsList.FirstOrDefault(x => x.SID == g.SID) != null)) list.Add(SecurityItem.FromGroup(g)); SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.Tag = 2; frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.Group; frm.CaptionText = "Добавление дочерних групп"; frm.VariantsCaption = "Доступные группы"; frm.ChoicesCaption = "Выбранные группы"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }