예제 #1
0
        public ImageRakerDownloadForm(string saveFolder, List<UrlPair> urls,
            FilePathMaker.FileNameMakingMethod fileNameMakingMethod, bool closeOnSucceed, ImageRaker.SaveType saveType)
        {
            InitializeComponent();

            this.saveFolder = saveFolder;
            this.urls = urls;
            this.fileNameMakingMethod = fileNameMakingMethod;
            this.closeOnSucceed = closeOnSucceed;
            //			this.overwrite = overwrite;
            //			this.transparent = transparent;
            this.saveType = saveType;

            messageLabel.Text = "이미지 다운로드 준비 중";
            progressLabel.Text = "0 / 0";
        }
예제 #2
0
        private void ImageRakerDownloadForm_Load(object sender, EventArgs e)
        {
            progressBar.Minimum = 0;
            progressBar.Maximum = urls.Count;
            progressBar.Value   = 0;
            progressBar.Step    = 1;

            // 별도 저장
            currentProgress = 0;

            bool close = false;

            try
            {
                Logger.Log("create imageraker! savefolder: {0}, filenamemakingmethod: {1}", saveFolder, fileNameMakingMethod);

                raker = new ImageRaker(saveFolder, fileNameMakingMethod, saveType);
            }
            catch (UnauthorizedAccessException ex)
            {
                Logger.Warn("cannot create imageraker!, UnauthorizedAccessException");

                exceptionMessage = "권한이 없습니다. 익스플로러를 관리자 권한으로 실행하십시오.";
                close            = true;
            }
            catch (DirectoryNotFoundException ex)
            {
                Logger.Warn("cannot create imageraker!, DirectoryNotFoundException");

                exceptionMessage = "잘못된 경로입니다. 경로를 다시 지정하십시오.";
                close            = true;
            }
            catch (IOException ex)
            {
                Logger.Warn("cannot create imageraker!, IOException");

                exceptionMessage = "잘못된 경로입니다. 경로를 다시 지정하십시오.";
                close            = true;
            }
            //catch (Exception ex)
            //{
            //    Logger.Warn("cannot create imageraker!, savefolder: {0}, filenamemakingmethod: {1}", saveFolder, fileNameMakingMethod);

            //    DialogResult = DialogResult.Abort;
            //    this.Close();
            //}

            if (close)
            {
                DialogResult = DialogResult.Abort;
                this.Close();
            }
            else
            {
                raker.Progress     += imageRaker_Progress;
                raker.SaveComplete += imageRaker_SaveComlete;

                int numOfThreads = Config.Instance.GetConfigInt("NumOfThreads");

                if (numOfThreads < MinNumOfThreads)
                {
                    numOfThreads = MinNumOfThreads;
                }
                if (numOfThreads > MaxNumOfThreads)
                {
                    numOfThreads = MaxNumOfThreads;
                }

                raker.SaveImages(urls, numOfThreads, AbortTimeout);
            }
        }
예제 #3
0
        private void ImageRakerDownloadForm_Load(object sender, EventArgs e)
        {
            progressBar.Minimum = 0;
            progressBar.Maximum = urls.Count;
            progressBar.Value = 0;
            progressBar.Step = 1;

            // 별도 저장
            currentProgress = 0;

            bool close = false;

            try
            {
                Logger.Log("create imageraker! savefolder: {0}, filenamemakingmethod: {1}", saveFolder, fileNameMakingMethod);

                raker = new ImageRaker(saveFolder, fileNameMakingMethod, saveType);
            }
            catch(UnauthorizedAccessException ex)
            {
                Logger.Warn("cannot create imageraker!, UnauthorizedAccessException");

                exceptionMessage = "권한이 없습니다. 익스플로러를 관리자 권한으로 실행하십시오.";
                close = true;
            }
            catch(DirectoryNotFoundException ex)
            {
                Logger.Warn("cannot create imageraker!, DirectoryNotFoundException");

                exceptionMessage = "잘못된 경로입니다. 경로를 다시 지정하십시오.";
                close = true;
            }
            catch(IOException ex)
            {
                Logger.Warn("cannot create imageraker!, IOException");

                exceptionMessage = "잘못된 경로입니다. 경로를 다시 지정하십시오.";
                close = true;
            }
            //catch (Exception ex)
            //{
            //    Logger.Warn("cannot create imageraker!, savefolder: {0}, filenamemakingmethod: {1}", saveFolder, fileNameMakingMethod);

            //    DialogResult = DialogResult.Abort;
            //    this.Close();
            //}

            if(close)
            {
                DialogResult = DialogResult.Abort;
                this.Close();
            }
            else
            {
                raker.Progress += imageRaker_Progress;
                raker.SaveComplete += imageRaker_SaveComlete;

                int numOfThreads = Config.Instance.GetConfigInt("NumOfThreads");

                if (numOfThreads < MinNumOfThreads)
                    numOfThreads = MinNumOfThreads;
                if (numOfThreads > MaxNumOfThreads)
                    numOfThreads = MaxNumOfThreads;

                raker.SaveImages(urls, numOfThreads, AbortTimeout);
            }
        }
예제 #4
0
        public void SendUsageReport(string pageUrl, int total, int failed, int elapsed, ImageRaker.SaveType saveType)
        {
            Dictionary<string, string> post = new Dictionary<string, string>();

            FillPostBasics(post);

            post.Add("PageUrl", pageUrl);
            post.Add("Total", total.ToString());
            post.Add("Failed", failed.ToString());
            post.Add("Elapsed", elapsed.ToString());
            post.Add("SaveType", ((int)saveType).ToString());

            // from previous value
            post.Add("SaveCountInSession", saveCountInSession.ToString());
            post.Add("FormLoadTime", formLoadTime.ToString());

            Report(post, UsageReportUrl, Config.Instance.GetConfigBool("ImproveProgram"));
        }