Beispiel #1
0
        public void OnVote(string data)
        {
            Regex voteregex = new Regex("(?<actor>[^,]+),(?<victim>.+)");
            Match m         = voteregex.Match(data);

            if (m.Success)
            {
                try
                {
                    int actor  = Int32.Parse(m.Groups["actor"].Value);
                    int victim = Int32.Parse(m.Groups["victim"].Value);

                    foreach (Client cl in otherClients) // if any of the online clients is voted, vote him back!
                    {
                        if (cl.getPacketHandler().getLocalId() == victim)
                        {
                            ph.send_vote(actor);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ph.LogConsole(ex.Message);
                }
                //
            }
        }