コード例 #1
0
 public new static MessageCreateFrame FromJson(JsonValue json)
 {
     if (json.IsNull)
     {
         return(null);
     }
     return(new MessageCreateFrame
     {
         opCode = json["op"],
         sequence = json["s"],
         type = json["t"],
         data = Message.FromJson(json["d"]),
     });
 }
コード例 #2
0
ファイル: Channel.cs プロジェクト: Luciano-0/2048-Demo
        public static Channel FromJson(JsonValue json)
        {
            if (json.IsNull)
            {
                return(null);
            }

            Dictionary <string, Group> groupMap = null;

            if (!json["groupMap"].IsNull)
            {
                using (var cursor = json["groupMap"].AsJsonObject.GetEnumerator())
                {
                    groupMap = new Dictionary <string, Group>();
                    while (cursor.MoveNext())
                    {
                        groupMap[cursor.Current.Key] = Group.FromJson(cursor.Current.Value);
                    }
                }
            }

            return(new Channel
            {
                id = json["id"],
                type = json["type"],
                workspaceId = json["workspaceId"],
                thumbnail = json["thumbnail"],
                name = json["name"],
                memberCount = json["memberCount"],
                topic = json["topic"],
                lastMessage = Message.FromJson(json["lastMessage"]),
                lastMessageId = json["lastMessageId"],
                liveChannelId = json["liveChannelId"],
                isMute = json["isMute"],
                groupId = json["groupId"],
                stickTime = json["stickTime"],
                groupMap = groupMap,
            });
        }