// -------------------------------------------------------------------------------- // speichert die positions als stack für LIFO - Pop() // -------------------------------------------------------------------------------- Stack seats; seats = getSeats(TotalPlayers); // -------------------------------------------------------------------------------- // speichert seats reihenfolge in array // -------------------------------------------------------------------------------- int i = 0; hMatches = Regex.Matches(history, @"Seat\s(\d+):\s(\w+)\s\(\s\$(.+)\s\)"); int[] playersort = new int[hMatches.Count]; foreach (Match hMatch in hMatches) { playersort[i] = Convert.ToInt16(hMatch.Groups[1].ToString()); i++; } // -------------------------------------------------------------------------------- // sortiert array nach den sitzen // -------------------------------------------------------------------------------- Array.Sort(playersort); // -------------------------------------------------------------------------------- // speicher spieler infos Dealer und darauf folgende spieler // -------------------------------------------------------------------------------- i = 0; foreach (int seatno in playersort) { if (seatno == ButtonSeat) { players.Add(i, new Dictionary()); players[i].Add("PlayerSeatNumber", seatno.ToString()); players[i].Add("PlayerName", Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[1].ToString()); players[i].Add("PlayerStack", Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[2].ToString()); players[i].Add("PlayerSeatTitle", "Button"); // line löschen history = Regex.Replace(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\).*?\n", ""); i++; } else if (seatno > ButtonSeat) { players.Add(i, new Dictionary()); players[i].Add("PlayerSeatNumber", seatno.ToString()); players[i].Add("PlayerName", Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[1].ToString()); players[i].Add("PlayerStack", Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[2].ToString()); players[i].Add("PlayerSeatTitle", seats.Pop().ToString()); // line löschen history = Regex.Replace(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\).*?\n", ""); i++; } } // -------------------------------------------------------------------------------- // speicher spieler infos von denen die vor dem button sitzen // -------------------------------------------------------------------------------- foreach (int seatno in playersort) { if (seatno < ButtonSeat) { players.Add(i, new Dictionary()); players[i].Add("PlayerSeatNumber", seatno.ToString()); players[i].Add("PlayerName", Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[1].ToString()); players[i].Add("PlayerStack", Regex.Match(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\)").Groups[2].ToString()); players[i].Add("PlayerSeatTitle", seats.Pop().ToString()); // line löschen history = Regex.Replace(history, @"Seat\s" + seatno + @":\s(\w+)\s\(\s\$(.+)\s\).*?\n", ""); i++; } }