Jaanus

Jaanus

  • NA
  • 1
  • 0

Could not load 'Microsoft.Practices.EnterpriseLibrary.Common

Mar 12 2010 3:38 PM
ques. -Sockets A2S_PLAYERS response problem, can't get all data readed.
 
Hello,
 
I have a problem with GameServer Query A2S_PLAYER query, 
If there are like 6 people in server, then the code only ready 3, but if i look the data what is recived, then i can see all 6, can anybody help me with that?
I have searched and played with the code many days already but can't get it work correctly.
Query information: http://developer.valvesoftware.com/wiki/Server_queries Look at A2S_PLAYER Section.
Thank you.
  1. SourceQuery ret = new SourceQuery();  
  2. int i =0;  
  3. var Players = new ListView();  
  4. ret.Response = Encoding.Default.GetString(resp);  
  5. //if (Type == 0x6D)  
  6. //{  
  7. ret.Magic = BitConverter.ToInt32(resp, 0);  
  8. i += sizeof(Int32);  
  9. ret.Type = resp[i++];  
  10. ret.NumPlayers = resp[i++];  
  11. int NumPlayers = ret.NumPlayers;  
  12. int pNR = 0;  
  13. i = 6;  
  14. while (pNR < NumPlayers && i < resp.Length)  
  15. {  
  16. var PlayerItem = new ListViewItem();  
  17. PlayerItem.Name = "Player";  
  18. PlayerItem.Text = GetString(resp, ++i, resp.Length);  
  19. i += PlayerItem.Text.Length + 1;  
  20. var Score = new System.Windows.Forms.ListViewItem.ListViewSubItem();  
  21. Score.Name = "Score";  
  22. Score.Text = BitConverter.ToInt32(resp, i).ToString();  
  23. i += 4;  
  24. PlayerItem.SubItems.Add(Score);  
  25. var PlayTime = new System.Windows.Forms.ListViewItem.ListViewSubItem();  
  26. PlayTime.Name = "Time";  
  27. PlayTime.Text = new TimeSpan(0, 0, (int)BitConverter.ToSingle(resp, i)).ToString();  
  28. i += 4;  
  29. PlayerItem.SubItems.Add(PlayTime);  
  30. pNR++;  
  31. Players.Items.Add(PlayerItem);  
  32. }