Exemple #1
0
        public CommentInfo DeleteComment(CommentInfo info, bool both)
        {
            // HTTP 요청에 딜레이를 주어 서버 오류 방지
            int delay = 50;
            GallogCommentDeleteParameters delParams = null;

            try
            {
                delParams = this.GetDeleteCommentInfo(info.DeleteURL);
            }
            catch (ThreadAbortException) { throw; }
            catch (Exception e)
            {
                info.ActualDelete  = false;
                info.GallogDelete  = false;
                info.DeleteMessage = e.Message;

                return(info);
            }

            info.GalleryCommentDeleteParameters = new GalleryCommentDeleteParameters()
            {
                GalleryId = delParams.GalleryId,
                ArticleId = delParams.ArticleId,
                CommentId = delParams.CommentId
            };
            info.GallogCommentDeleteParameters = delParams;

            Thread.Sleep(delay);

            return(DeleteComment(info, true, both));
        }
Exemple #2
0
        internal static GallogCommentDeleteParameters GetDeleteGallogCommentParameters(string pageHtml)
        {
            GallogCommentDeleteParameters newParams = new GallogCommentDeleteParameters();

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(pageHtml);

            HtmlNode parentNode    = doc.GetElementbyId("dTp").ParentNode;
            HtmlNode idNode        = parentNode.SelectSingleNode(".//input[@name='id']");
            HtmlNode cidNode       = parentNode.SelectSingleNode(".//input[@name='cid']");
            HtmlNode artNode       = parentNode.SelectSingleNode(".//input[@name='no']");
            HtmlNode cNode         = parentNode.SelectSingleNode(".//input[@name='c_no']");
            HtmlNode logNode       = parentNode.SelectSingleNode(".//input[@name='logNo']");
            int      inputCnt      = doc.DocumentNode.Descendants("input").Count();
            HtmlNode randomKeyNode = doc.DocumentNode.SelectSingleNode("//input[" + (inputCnt - 1) + "]");

            newParams.GalleryId       = idNode.Attributes["value"].Value;
            newParams.GalleryNo       = cidNode.Attributes["value"].Value;
            newParams.ArticleId       = artNode.Attributes["value"].Value;
            newParams.CommentId       = cNode.Attributes["value"].Value;
            newParams.LogNo           = logNode.Attributes["value"].Value;
            newParams.AdditionalKey   = randomKeyNode.Attributes["name"].Value;
            newParams.AdditionalValue = randomKeyNode.Attributes["value"].Value;

            return(newParams);
        }
Exemple #3
0
        private GallogCommentDeleteParameters GetDeleteCommentInfo(string url)
        {
            string galHtml = HttpRequest.RequestDeleteGallogCommentPage(url, user_id, ref cookies);
            GallogCommentDeleteParameters retParams = HtmlParser.GetDeleteGallogCommentParameters(galHtml);

            retParams.UserId = user_id;
            return(retParams);
        }