コード例 #1
0
ファイル: ACChannelsData.cs プロジェクト: FgoDt/AcFunVideo
        private ChannelContent ParseChannel(JToken token)
        {
            ChannelContent cc;

            try
            {
                var channels  = token["childChannels"].ToList();
                var id        = token["id"].ToString();
                var img       = token["img"].ToString();
                var name      = token["name"].ToString();
                var pid       = token["pid"].ToString();
                var channelId = token["channelid"];
                var contents  = token["contents"];
                cc       = new ChannelContent();
                cc.id    = id;
                cc.Cover = img;
                cc.Title = name;
                cc.pid   = pid;
                if (contents != null)
                {
                }
                foreach (var channel in channels)
                {
                    if (cc.ChildChannels == null)
                    {
                        cc.ChildChannels = new List <ChannelContent>();
                    }
                    var ccc = this.ParseChannel(channel);
                    cc.ChildChannels.Add(ccc);
                }
            }
            catch (Exception ex)
            {
                cc = null;
            }
            return(cc);
        }
コード例 #2
0
        private ChannelContent ParseEachData(JToken token)
        {
            ChannelContent accd = new ChannelContent();

            try
            {
                var belong    = token["belong"].ToString();
                var channelid = token["channelId"].ToString();
                var Contents  = token["contents"];
                var id        = token["id"].ToString();
                var image     = token["image"].ToString();
                var name      = token["name"].ToString();
                var type      = token["type"]["value"].ToString();
                accd.id    = id;
                accd.Cover = image;
                accd.Type  = type;
                accd.Title = name;
                if (Contents != null)
                {
                    foreach (var content in Contents)
                    {
                        if (accd.ACContetns == null)
                        {
                            accd.ACContetns = new List <AcContent>();
                        }

                        var ac = this.ParseContentsData(content, type);
                        ac.Type = type;
                        accd.ACContetns.Add(ac);
                    }
                }
            }
            catch
            {
            }
            return(accd);
        }