Exemple #1
0
        void UpdateArea(double dx, double dy, UpCommentInfo ci, UIPoint[] up, Item cc)
        {
            cc.bor.Margin   = new Thickness(0, dy, 0, 0);
            cc.ell.Margin   = new Thickness(0, dy + 5, 0, 0);
            cc.title.Margin = new Thickness(54, dy, 0, 0);
            cc.time.Margin  = new Thickness(54, dy + 24, 0, 0);
            if (ci.url != null & ci.url != "")
            {
                cc.map.UriSource = new Uri(ci.url);
            }
            string str = ci.nick + "  uid:" + ci.u_id;// + "  mid:" + buff_com[i].uidB;

            cc.title.Text = str;
            cc.time.Text  = ci.time + ci.region;
            dy           += 54;
            List <UpContent> lu = ci.detail_s;
            int c  = lu.Count;
            int ts = 0;
            int ms = 0;

            TextBlock[] t = cc.ltb;
            Picture[]   p = cc.lp;
            for (int i = 0; i < c; i++)
            {
                if (lu[i].type == 'i')//image
                {
                    p[ms].map.UriSource = new Uri(lu[i].content);
                    double ox = dx + up[i].ox;
                    double oy = dy + up[i].oy;
                    p[ms].img.Margin = new Thickness(ox, oy, 0, 0);
                    ms++;
                }
                else//text
                {
                    t[ts].Text   = up[i].content;
                    t[ts].Width  = width;
                    t[ts].Height = up[i].height;
                    double ox = dx + up[i].ox;
                    double oy = dy + up[i].oy;
                    t[ts].Margin = new Thickness(ox, oy, 0, 0);
                    ts++;
                }
            }
        }
        public static int AnalyUpComment(ref char[] c_buff, List <UpCommentInfo> luc)
        {
            int           s = 0, ss = luc.Count;
            UpCommentInfo ci = new UpCommentInfo();
            int           i, rid = ss;

            for (i = 0; i < 10; i++)
            {
                s = FindCharArray(ref c_buff, ref Key_js_id, s);//id
                if (s < 0)
                {
                    break;
                }
                ci.m_id = new string(FindCharArrayA(ref c_buff, '\"', '\"', ref s));
                int r = FindCharArray(ref c_buff, ref Key_js_rootid, s, s + 20);//rootid
                if (r > 0)
                {
                    ci.m_r_id = new string(FindCharArrayA(ref c_buff, '\"', '\"', ref r));
                    ci.rid    = rid;
                    s         = r;
                }
                else
                {
                    ci.m_r_id = null; rid = i + ss;
                };

                s       = FindCharArray(ref c_buff, ref Key_js_userid, s);//userid
                ci.u_id = new string(FindCharArrayA(ref c_buff, '\"', '\"', ref s));

                s = FindCharArray(ref c_buff, ref Key_up, s);//up
                char[] tt = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                ci.approval = CharToInt(ref tt);
                string str = "(" + new string(tt) + ")赞 (";

                s          = FindCharArray(ref c_buff, ref Key_poke, s);//poke
                tt         = FindCharArrayA(ref c_buff, ':', ',', ref s);
                ci.against = CharToInt(ref tt);
                str       += new string(tt) + ")反对 (";

                s         = FindCharArray(ref c_buff, ref Key_rep, s);//rep
                tt        = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                ci.replay = CharToInt(ref tt);
                str      += new string(tt) + ")回复";
                ci.count  = str;

                s        = FindCharArray(ref c_buff, ref Key_titleB, s);//title
                tt       = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                ci.title = GetString16A(ref tt);

                s           = FindCharArray(ref c_buff, ':', s);
                tt          = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                s           = FindCharArray(ref c_buff, ref Key_content, s);//content
                ci.detail_s = new List <UpContent>();
                int o = GetUpCom_Content(ref c_buff, s, ci.detail_s);
                if (o > 0)
                {
                    s = o;
                }
                if (ci.detail_s.Count == 0)
                {
                    UpContent u = new UpContent();
                    tt     = GetCharArray16A(ref tt);
                    u.text = tt;
                    u.type = 't';
                    ci.detail_s.Add(u);
                }

                s       = FindCharArray(ref c_buff, ref Key_js_timeD, s);//timeDifference
                tt      = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                ci.time = GetString16A(ref tt);

                s       = FindCharArray(ref c_buff, ref Key_js_nick, s);//nick
                tt      = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                ci.nick = GetString16(ref tt);

                s = FindCharArray(ref c_buff, ref Key_js_head, s);//head
                int t = s;
                tt = FindCharArrayA(ref c_buff, '\"', '\"', ref t);
                if (tt != null)
                {
                    ci.url = new string(DeleteChar(ref tt, '\\'));
                }

                s         = FindCharArray(ref c_buff, ref Key_js_region, s);//region
                tt        = FindCharArrayA(ref c_buff, '\"', '\"', ref s);
                ci.region = GetString16(ref tt);

                s      = FindCharArray(ref c_buff, ref Key_js_vip, s);//viptype
                ci.vip = new string(FindCharArrayA(ref c_buff, ':', ',', ref s));

                s        = FindCharArray(ref c_buff, ref Key_score, s);//score
                tt       = FindCharArrayA(ref c_buff, ':', ',', ref s);
                ci.score = CharToInt(ref tt);

                luc.Add(ci);
            }
            return(i);
        }