diff --git a/RH-Engine/JSONParser.cs b/RH-Engine/JSONParser.cs index d42adb6..bda371c 100644 --- a/RH-Engine/JSONParser.cs +++ b/RH-Engine/JSONParser.cs @@ -10,20 +10,23 @@ namespace RH_Engine class JSONParser { /// - /// parses the given response from the server into strings + /// returns all the users from the given response /// /// the message gotten from the server, without the length prefix /// - public static string[] Parse(string msg) + public static PC[] GetUsers(string msg) { dynamic jsonData = JsonConvert.DeserializeObject(msg); Newtonsoft.Json.Linq.JArray data = jsonData.data; + PC[] res = new PC[data.Count]; + int counter = 0; foreach (dynamic d in data) { - Console.WriteLine(d.clientinfo.host); + res[counter] = new PC(d.clientinfo.host, d.clientinfo.user); + counter++; } - return null; + return res; }