melonvpn-original-cs/MelonVPNCore/ClientListParser.cs

21 lines
575 B
C#
Raw Permalink Normal View History

2020-09-22 23:10:16 +01:00
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();
}
}
}