Skip to content

Commit

Permalink
Add a new label that shows how many pictures are left. Also, a console
Browse files Browse the repository at this point in the history
window does not appear in Release mode anymore.
  • Loading branch information
fgRuslan committed Jul 15, 2019
1 parent b9a294d commit 1e9df92
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions DanEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public int getPostCount(string domain, string tags)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(domain + "/posts.xml?page=dapi&s=post&q=index&tags=" + tags);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
#if DEBUG
AllocConsole();
#endif
using (Stream stream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
Expand Down
14 changes: 14 additions & 0 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private void Form1_Load(object sender, EventArgs e)

tagsBox.GotFocus += new EventHandler(this.TagsGotFocus);
tagsBox.LostFocus += new EventHandler(this.TagsLostFocus);
label4.Text = "";
}

public void TagsGotFocus(object sender, EventArgs e)
Expand Down Expand Up @@ -76,10 +77,11 @@ private async void downloadButton_Click(object sender, EventArgs e)
for (int i = 1; i < postCount; i++)
{
await Task.Run(() => engine.downloadPosts(domainBox.Text, tagsBox.Text, i, checkBox1.Checked));
statusLabel.Text = "Downloading..." + Convert.ToString(postCount - i);
label4.Text = Convert.ToString(postCount - i) + " left";
}
statusLabel.ForeColor = Color.Green;
statusLabel.Text = "Ready.";
label4.Text = "";
MessageBox.Show("Download compelete!", "BooruDownloader", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
}
}
Expand All @@ -102,10 +104,11 @@ private async void downloadButton_Click(object sender, EventArgs e)
for (int i = 0; i < postCount; i++)
{
await Task.Run(() => engine.downloadPosts(domainBox.Text, tagsBox.Text, i, checkBox1.Checked));
statusLabel.Text = "Downloading..." + Convert.ToString(postCount - i);
label4.Text = Convert.ToString(postCount - i) + " left";
}
statusLabel.ForeColor = Color.Green;
statusLabel.Text = "Ready.";
label4.Text = "";
MessageBox.Show("Download compelete!", "BooruDownloader", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
}

Expand Down
2 changes: 2 additions & 0 deletions GelEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public int getPostCount(string domain, string tags)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(domain + "/index.php?page=dapi&s=post&q=index&limit=1&tags=" + tags);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
#if DEBUG
AllocConsole();
#endif
string result = "";
using (Stream stream = response.GetResponseStream())
{
Expand Down

0 comments on commit 1e9df92

Please sign in to comment.