public static void GetInputs(SocketState sock) { char[] x = new char[1] { '\n' }; HashSet <string[]> test = new HashSet <string[]>(); //this regex gets everything inbetween parenthesis string pattern = Regex.Escape("(") + "(.*?)"; Ship s = new Ship(); try { int playerID = sock.ID; s = world.ship[playerID]; } catch { } string[] strs = sock.sb.ToString().Split(x, StringSplitOptions.RemoveEmptyEntries); foreach (string str in strs) { if (str.Length > 1 && Regex.IsMatch(str, "^[(]") && str[str.Length - 1] == 41) { { if (str.Contains("F")) { s.FlagShoot(); } if (str.Contains("R")) { s.FlagRight(); } if (str.Contains("L")) { s.FlagLeft(); } if (str.Contains("T")) { s.FlagThrust(); } } } sock.sb.Remove(0, str.Length - 1); } Networking.GetData(sock); }