Beispiel #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     txtConsole.Text    = "";
     textBox2.Text      = "";
     richTextBox1.Text  = "";
     progressBar1.Value = 0;
     button1.Enabled    = true;
     ModifyProgressBarColor.SetState(progressBar1, 1);
 }
Beispiel #2
0
        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;

            if (e.ProgressPercentage != 100)
            {
                return;
            }

            txtConsole.Text = "";

            ClipResult result = (ClipResult)e.UserState;

            if (result.status != "success")
            {
                txtConsole.AppendText(result.status + System.Environment.NewLine);
                txtConsole.AppendText(result.message);
                ModifyProgressBarColor.SetState(progressBar1, 2);
                return;
            }

            foreach (ParsedLink link in result.ParsedLinks)
            {
                richTextBox1.SelectionColor = link.GetColour();
                if (!link.AlternativeProposed)
                {
                    if (link.Url.Count == 1)
                    {
                        richTextBox1.AppendText(link.InnerText + " " + link.Url[0] + Environment.NewLine);
                    }
                    else
                    {
                        richTextBox1.AppendText(link.InnerText + Environment.NewLine);
                        richTextBox1.AppendText(link.Url.Select(l => "    " + l + Environment.NewLine).Aggregate((a, b) => a + b));
                    }
                }
                else
                {
                    if (link.Url.Count == 1)
                    {
                        richTextBox1.AppendText(string.Format("{1}{0}    Original: {2}{0}    Proposed: {3}{0}", Environment.NewLine, link.InnerText, link.OriginalUrl, link.Url[0]));
                    }
                    else
                    {
                        richTextBox1.AppendText(string.Format("{1}{0}    Original: {2}{0}    Proposed:{0}", Environment.NewLine, link.InnerText, link.OriginalUrl));
                        richTextBox1.AppendText(link.Url.Select(l => "    " + l + Environment.NewLine).Aggregate((a, b) => a + b));
                    }
                }
            }

            txtConsole.AppendText("Results for " + result.Title + System.Environment.NewLine + System.Environment.NewLine);

            txtConsole.AppendText("Links Analyzed: " + result.ParsedLinks.Count() + System.Environment.NewLine);
            txtConsole.AppendText("Valid JDownload Links found: " + result.JLinksCount + System.Environment.NewLine);
            txtConsole.AppendText("Total Links found: " + result.ParsedLinks.Select(l => l.Url.Count).Sum() + System.Environment.NewLine + System.Environment.NewLine);

            if (result.LinkDupes.Count() > 0)
            {
                txtConsole.AppendText(string.Format("Duplicate links ({0}) found at:{1}", result.LinkDupes.Count(), System.Environment.NewLine));
                foreach (string dupe in result.LinkDupes)
                {
                    txtConsole.AppendText("    " + dupe + System.Environment.NewLine);
                }
            }

            if (result.SourceDupes.Count() > 0)
            {
                txtConsole.AppendText(string.Format("Source numbers duplicated ({0}):{1}", result.SourceDupes.Count(), System.Environment.NewLine));
                foreach (int dupe in result.SourceDupes)
                {
                    txtConsole.AppendText(string.Format("    Source[{0}]{1}", dupe, System.Environment.NewLine));
                }
            }

            if (result.SourceMissing.Count() > 0)
            {
                txtConsole.AppendText(string.Format("The following source numbers ({0}) could not be found:{1}", result.SourceMissing.Count(), System.Environment.NewLine));
                foreach (int missing in result.SourceMissing)
                {
                    txtConsole.AppendText(string.Format("    Source[{0}]{1}", missing, System.Environment.NewLine));
                }
            }

            if (result.BrokenDeviantArtLinks.Count() > 0)
            {
                txtConsole.AppendText(string.Format("The following images ({0}) have broken DeviantArt links:{1}", result.BrokenDeviantArtLinks.Count(), System.Environment.NewLine));
                foreach (ParsedLink link in result.BrokenDeviantArtLinks)
                {
                    txtConsole.AppendText(string.Format("   Source[{0}]: {1}{2}", link.Source, link.Url[0], System.Environment.NewLine));
                }
            }

            if (result.AlternativeLinks.Count() > 0)
            {
                txtConsole.AppendText(string.Format("The following images ({0}) are not deviant art links and the image preview is being used:{1}", result.AlternativeLinks.Count(), System.Environment.NewLine));
                foreach (ParsedLink link in result.AlternativeLinks)
                {
                    txtConsole.AppendText(string.Format("   Source[{0}]: {1}", link.Source, link.Url.Select(l => l + Environment.NewLine).Aggregate((a, b) => a + b)));
                }
            }

            textBox2.Text = result.JLinks;

            txtConsole.AppendText(System.Environment.NewLine + "Thank you for using EQD DA Clipper!");
        }