예제 #1
0
        public async Task <CommentInformation> DeleteComment(CommentInformation info, bool actualDelete, bool both)
        {
            // HTTP 요청에 딜레이를 주어 서버 오류 방지
            int delay = 50;

            DeleteResult res1 = null;

            try
            {
                res1 = await PostDeleteGalleryCommentAsync(info.GalleryDeleteParameter);
            }
            catch (Exception ex)
            {
                info.IsGalleryDeleted = false;
                info.IsGallogDeleted  = false;
                info.DeleteMessage    = "갤러리의 리플을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                return(info);
            }

            if (!res1.Success && res1.ErrorMessage != "이미 삭제된 리플입니다.")
            {
                info.IsGalleryDeleted = false;
                info.IsGallogDeleted  = false;
                info.DeleteMessage    = "갤러리의 리플을 지우는데 실패하였습니다 - [" + res1.ErrorMessage + "]";

                return(info);
            }

            if (both)
            {
                await Task.Delay(delay);

                DeleteResult res2 = null;

                try
                {
                    res2 = await PostDeleteGallogCommentAsync(info.GallogDeleteParameter, delay);
                }
                catch (Exception ex)
                {
                    info.IsGalleryDeleted = true;
                    info.IsGallogDeleted  = false;
                    info.DeleteMessage    = "갤로그의 리플을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                    return(info);
                }

                if (!res2.Success)
                {
                    info.IsGalleryDeleted = true;
                    info.IsGallogDeleted  = false;
                    info.DeleteMessage    = "갤로그의 리플을 지우는데 실패하였습니다 - [" + res2.ErrorMessage + "]";

                    return(info);
                }
            }

            info.IsGalleryDeleted = true;
            info.IsGallogDeleted  = true;
            info.DeleteMessage    = "";

            return(info);
        }
예제 #2
0
        public CommentInfo DeleteComment(CommentInfo info, bool actualDelete, bool both)
        {
            // HTTP 요청에 딜레이를 주어 서버 오류 방지
            int delay = 50;

            DeleteResult res1 = null;

            try
            {
                res1 = HttpRequest.RequestDeleteComment(info.GalleryCommentDeleteParameters, ref cookies);
            }
            catch (ThreadAbortException) { throw; }
            catch (Exception ex)
            {
                info.ActualDelete  = false;
                info.GallogDelete  = false;
                info.DeleteMessage = "갤러리의 리플을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                return(info);
            }

            if (!res1.Success && res1.ErrorMessage != "이미 삭제된 리플입니다.")
            {
                info.ActualDelete  = false;
                info.GallogDelete  = false;
                info.DeleteMessage = "갤러리의 리플을 지우는데 실패하였습니다 - [" + res1.ErrorMessage + "]";

                return(info);
            }

            if (both)
            {
                Thread.Sleep(delay);

                DeleteResult res2 = null;

                try
                {
                    res2 = HttpRequest.RequestDeleteGallogComment(info.GallogCommentDeleteParameters, delay, ref cookies);
                }
                catch (Exception ex)
                {
                    info.ActualDelete  = true;
                    info.GallogDelete  = false;
                    info.DeleteMessage = "갤로그의 리플을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                    return(info);
                }

                if (!res2.Success)
                {
                    info.ActualDelete  = true;
                    info.GallogDelete  = false;
                    info.DeleteMessage = "갤로그의 리플을 지우는데 실패하였습니다 - [" + res2.ErrorMessage + "]";

                    return(info);
                }
            }

            info.ActualDelete  = true;
            info.GallogDelete  = true;
            info.DeleteMessage = "";

            return(info);
        }
예제 #3
0
        public async Task <ArticleInformation> DeleteArticle(ArticleInformation info, GalleryType gallType, bool both)
        {
            // HTTP 요청에 딜레이를 주어 서버 오류 방지
            int delay = 50;

            DeleteResult res1 = null;

            try
            {
                if (LoginInfo.IsLoggedIn)
                {
                    res1 = await PostDeleteGalleryArticleAsync(info.GalleryDeleteParameter, gallType, delay);
                }
                else
                {
                    res1 = await PostDeleteGalleryFlowArticleAsync(info.GalleryDeleteParameter, gallType, delay);
                }
            }
            catch (Exception ex)
            {
                info.IsGalleryDeleted = false;
                info.IsGallogDeleted  = false;
                info.DeleteMessage    = "갤러리의 글을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                return(info);
            }

            if (!res1.Success && res1.ErrorMessage != "이미 삭제된 글입니다.")
            {
                info.IsGalleryDeleted = false;
                info.IsGallogDeleted  = false;
                info.DeleteMessage    = "갤러리의 글을 지우는데 실패하였습니다 - [" + res1.ErrorMessage + "]";

                return(info);
            }

            if (both)
            {
                await Task.Delay(delay);

                DeleteResult res2 = null;

                try
                {
                    res2 = await PostDeleteGallogArticleAsync(info.GallogDeleteParameter, delay);
                }
                catch (Exception ex)
                {
                    info.IsGalleryDeleted = true;
                    info.IsGallogDeleted  = false;
                    info.DeleteMessage    = "갤로그의 글을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                    return(info);
                }

                if (!res2.Success)
                {
                    info.IsGalleryDeleted = true;
                    info.IsGallogDeleted  = false;
                    info.DeleteMessage    = "갤로그의 글을 지우는데 실패하였습니다 - [" + res2.ErrorMessage + "]";

                    return(info);
                }
            }

            info.IsGalleryDeleted = true;
            info.IsGallogDeleted  = true;
            return(info);
        }
예제 #4
0
        public ArticleInfo DeleteArticle(ArticleInfo info, GalleryType gallType, bool both)
        {
            // HTTP 요청에 딜레이를 주어 서버 오류 방지
            int delay = 50;

            DeleteResult res1 = null;

            try
            {
                if (IsLogin)
                {
                    res1 = HttpRequest.RequestDeleteArticle(info.GalleryArticleDeleteParameters, gallType, delay, ref cookies);
                }
                else
                {
                    res1 = HttpRequest.RequestDeleteFlowArticle(info.GalleryArticleDeleteParameters, gallType, delay, ref cookies);
                }
            }
            catch (ThreadAbortException) { throw; }
            catch (Exception ex)
            {
                info.ActualDelete  = false;
                info.GallogDelete  = false;
                info.DeleteMessage = "갤러리의 글을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                return(info);
            }

            if (!res1.Success && res1.ErrorMessage != "이미 삭제된 글입니다.")
            {
                info.ActualDelete  = false;
                info.GallogDelete  = false;
                info.DeleteMessage = "갤러리의 글을 지우는데 실패하였습니다 - [" + res1.ErrorMessage + "]";

                return(info);
            }

            if (both)
            {
                Thread.Sleep(delay);

                DeleteResult res2 = null;

                try
                {
                    res2 = HttpRequest.RequestDeleteGallogArticle(info.GallogArticleDeleteParameters, delay, ref cookies);
                }
                catch (ThreadAbortException) { throw; }
                catch (Exception ex)
                {
                    info.ActualDelete  = true;
                    info.GallogDelete  = false;
                    info.DeleteMessage = "갤로그의 글을 지우는데 실패하였습니다 - [" + ex.Message + "]";

                    return(info);
                }

                if (!res2.Success)
                {
                    info.ActualDelete  = true;
                    info.GallogDelete  = false;
                    info.DeleteMessage = "갤로그의 글을 지우는데 실패하였습니다 - [" + res2.ErrorMessage + "]";

                    return(info);
                }
            }

            info.ActualDelete = true;
            info.GallogDelete = true;
            return(info);
        }