Esempio n. 1
0
        public Form1()
        {
            this.InitializeComponent();

            var logger = new TextBoxLogger(this, this.richTextBoxLogger);

            this.tpd = new TumblrPicDownloader(logger);
            var wat = textBoxOutput;
        }
Esempio n. 2
0
        private void UpdateInformationBox()
        {
            string pagesProcessed = (this.tpd.LastPageOnBlog >= 0)
                ? this.tpd.LastPageOnBlog + " (Last)"
                : this.tpd.StartPage.ToString();

            string picsDownloaded = (this.tpd.BadFiles == 0)
                ? this.tpd.PicsDownloadedSoFar.ToString()
                : this.tpd.PicsDownloadedSoFar.ToString() + " (" + this.tpd.BadFiles + ")";

            var nl        = Environment.NewLine;
            var totalSize = this.tpd.ShowSizeSoFar.Split(
                new char[] { ' ' },
                StringSplitOptions.RemoveEmptyEntries);

            double currentSize = double.Parse(totalSize[0]);

            this.timeElasted += TimerTick;
            double avarageSpeed = Math.Round(
                this.tpd.TotalSizeSoFar / this.timeElasted,
                2,
                MidpointRounding.AwayFromZero);

            var sb = new StringBuilder();

            sb.AppendLine("Size so far: " + this.tpd.ShowSizeSoFar);
            sb.AppendLine("Folder processed: " + pagesProcessed);
            sb.AppendLine("Found pictures so far: " + this.tpd.ShowFoundedImages);
            sb.AppendLine("Downloaded pictures so far: " + picsDownloaded);
            sb.AppendLine("Avarage speed: " +
                          TumblrPicDownloader.ShowSize(avarageSpeed) +
                          "/s");

            sb.AppendLine("Pictures per second: " +
                          Math.Round(
                              this.tpd.PicsDownloadedSoFar / this.timeElasted,
                              1,
                              MidpointRounding.AwayFromZero));

            sb.AppendLine("Time elapsed: " + this.timeElasted + " seconds");

            textBoxOutput.Text = sb.ToString();
        }