public static PackageSubsets FromDict(JsonData data) { return(new PackageSubsets { packages = data.Cast <JsonData>().Select(PackageSubset.FromDict).ToList(), }); }
/// <summary> /// Initializes a new instance of the <see cref="FriendsStreamEventArgs" /> class. /// </summary> /// <param name="json">The json encoded data.</param> public FriendsStreamEventArgs(string json) : base(json) { JsonData parsed = JsonMapper.ToObject(json)["friends"]; Friends = parsed.Cast <JsonData>().Select(j => (ulong)j).ToArray(); }
/// <summary> /// 反序列化协议包。 /// </summary> /// <param name="networkChannel">网络频道。</param> /// <param name="source">要反序列化的来源流。</param> /// <param name="customErrorData">用户自定义错误数据。</param> /// <returns>反序列化后的协议包。</returns> public override Packet Deserialize(INetworkChannel networkChannel, Stream source, out object customErrorData) { EuPacket p = new EuPacket(); StreamReader sr = new StreamReader(source); JsonData data = JsonMapper.ToObject(sr); p.Tag = data[0].ToString(); p.Args = data.Cast <object>().Skip(1).ToArray(); customErrorData = null; return(p); }