21 lines
575 B
C#
21 lines
575 B
C#
|
using System.Collections.Generic;
|
|||
|
using Newtonsoft.Json.Linq;
|
|||
|
|
|||
|
namespace MelonVPNCore
|
|||
|
{
|
|||
|
public static class ClientListParser
|
|||
|
{
|
|||
|
public static ConnectedClient[] Parse(string json)
|
|||
|
{
|
|||
|
List<ConnectedClient> clients = new List<ConnectedClient>();
|
|||
|
JArray a = JArray.Parse(json);
|
|||
|
|
|||
|
foreach (JObject o in a.Children<JObject>())
|
|||
|
{
|
|||
|
clients.Add(new ConnectedClient(o.GetValue("Name").ToString(), o.GetValue("IP").ToString()));
|
|||
|
}
|
|||
|
return clients.ToArray();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|