コード例 #1
0
ファイル: DCConnector.cs プロジェクト: Randgriz/DCCleaner
        public ArticleInfo DeleteArticle(ArticleInfo info, bool both)
        {
            // HTTP 요청에 딜레이를 주어 서버 오류 방지
            int delay = 50;

            GallogArticleDeleteParameters delParams = null;

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

                return(info);
            }

            info.GalleryArticleDeleteParameters = new GalleryArticleDeleteParameters()
            {
                GalleryId = delParams.GalleryId,
                ArticleID = delParams.ArticleId
            };
            info.GallogArticleDeleteParameters = delParams;

            Thread.Sleep(delay);

            return(DeleteArticle(info, GalleryType.Normal, both));
        }
コード例 #2
0
ファイル: HtmlParser.cs プロジェクト: Randgriz/DCCleaner
        internal static GallogArticleDeleteParameters GetDeleteGallogArticleParameters(string pageHtml)
        {
            GallogArticleDeleteParameters newParams = new GallogArticleDeleteParameters();

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(pageHtml);

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

            newParams.GalleryId       = gallNode.Attributes["value"].Value;
            newParams.GalleryNo       = cidNode.Attributes["value"].Value;
            newParams.ArticleId       = artNode.Attributes["value"].Value;
            newParams.LogNo           = logNode.Attributes["value"].Value;
            newParams.DCCKey          = dcc_keyNode.Attributes["value"].Value;
            newParams.AdditionalKey   = randomKeyNode.Attributes["name"].Value;
            newParams.AdditionalValue = randomKeyNode.Attributes["value"].Value;

            return(newParams);
        }
コード例 #3
0
ファイル: DCConnector.cs プロジェクト: Randgriz/DCCleaner
        private GallogArticleDeleteParameters GetDeleteArticleInfo(string url)
        {
            string galHtml = HttpRequest.RequestDeleteGallogArticlePage(url, user_id, ref cookies);
            GallogArticleDeleteParameters retParams = HtmlParser.GetDeleteGallogArticleParameters(galHtml);

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