Exemplo n.º 1
0
        static void ProcessPost(string post, ref string levelOneUid, ref string levelOnePid, string forum, string title)
        {
            var uid        = WebTool.GetContent("userinfo.php?id=", "&", post);
            var uName      = WebTool.StripTagsCharArray(WebTool.GetContent("<div class=\"fn\">", "</div>", post));
            var content    = WebTool.GetContent("<div class=\"single-post-content\">", "<div class=\"single-post-content-sig\">", post);
            var pid        = WebTool.GetContent("<div id=\"ct", "\"", post);
            var tmpar      = WebTool.GetContent("<div class=\"date\">", "</div>", post).Split('#');
            var pdate      = tmpar[0].Trim();
            var plevel     = tmpar[1].Trim();
            var aid        = string.Empty;
            var aowner     = string.Empty;
            var blockquite = WebTool.GetContent("<blockquote>", "</blockquote>", post);
            var replyTo    = WebTool.GetContent("<b>", " wrote:</b>", blockquite);

            Console.WriteLine(TmpUser == null);
            if (!TmpUser.ContainsKey(uName))
            {
                TmpUser.Add(uName, uid);
            }

            Console.WriteLine("pid=" + pid + " uid=" + uid + " name=" + uName);
            //if (!string.IsNullOrEmpty(replyTo)) Console.WriteLine("\tblockquote=" + replyTo);


            if (plevel == "1")
            {
                levelOnePid = pid;
                levelOneUid = uid;
            }
            else
            {
                aid    = levelOnePid;
                aowner = levelOneUid;

                //add counter
                if (string.IsNullOrEmpty(replyTo))
                {
                    //ThriftTool.CounterAdd(uid, "M01UserRelaction", levelOneUid, 1);
                }
                else
                {
                    Console.WriteLine("\tblockquote=" + TmpUser[replyTo]);
                }
                //
            }
            var topic = new M01Topic
            {
                Forum   = forum,
                Pid     = pid,
                Uid     = uid,
                Content = content,
                Pdate   = pdate,
                Plevel  = plevel,
                Aid     = aid,
                Aowner  = aowner,
                Title   = title
            };
            //if (blockquite != null)

            //SaveTopic(topic);
        }