Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit b2ee74e

Browse files
authored
Update
1 parent 9e991b5 commit b2ee74e

File tree

7 files changed

+122
-86
lines changed

7 files changed

+122
-86
lines changed

ProxyGrabber/Classes/webAPI.cs

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,61 @@ namespace ProxyGrabber.Classes
44
{
55
class webAPI
66
{
7-
string timeout;
8-
string proxytype;
9-
string country;
10-
string anonymity;
11-
string ssl;
12-
public webAPI(string timeout, string proxytype, string country, string anonymity, string ssl)
7+
WebClient Client = new WebClient();
8+
private string timeout;
9+
private string proxytype;
10+
private string country;
11+
private string anonymity;
12+
private string ssl;
13+
14+
public webAPI(string timeout = "10000", string proxytype = "all", string country = "all", string anonymity = "all", string ssl = "all")
15+
{
16+
setParameters(timeout, proxytype, country, anonymity, ssl);
17+
}
18+
19+
public void setParameters(string timeout, string proxytype, string country, string anonymity, string ssl)
20+
{
21+
setTimeout(timeout);
22+
setProxyType(proxytype);
23+
setCountry(country);
24+
setAnonymity(anonymity);
25+
setSSL(ssl);
26+
}
27+
28+
public void setTimeout(string timeout)
1329
{
1430
this.timeout = timeout;
31+
}
32+
33+
public void setProxyType(string proxytype)
34+
{
1535
this.proxytype = proxytype;
36+
}
37+
38+
public void setCountry(string country)
39+
{
1640
this.country = country;
41+
}
42+
43+
public void setAnonymity(string anonymity)
44+
{
1745
this.anonymity = anonymity;
18-
this.ssl = ssl;
1946
}
2047

21-
WebClient Client = new WebClient();
48+
public void setSSL(string ssl)
49+
{
50+
this.ssl = ssl;
51+
}
2252

23-
public string Lastupdated()
53+
public string lastUpdated()
2454
{
2555
if (proxytype == "all")
2656
return "Select Proxy Type";
2757
else
2858
return Client.DownloadString($"https://api.proxyscrape.com/?request=lastupdated&proxytype={proxytype}");
2959
}
3060

31-
public string AmountProxies()
61+
public string amountProxies()
3262
{
3363
return Client.DownloadString($"https://api.proxyscrape.com/?request=amountproxies&proxytype={proxytype}&timeout={timeout}&country={country}&anonymity={anonymity}&ssl={ssl}");
3464
}
@@ -37,5 +67,15 @@ public void Download(string path)
3767
{
3868
Client.DownloadFile($"https://api.proxyscrape.com?request=getproxies&proxytype={proxytype}&timeout={timeout}&country={country}&anonymity={anonymity}&ssl={ssl}", path);
3969
}
70+
71+
public void Dispose()
72+
{
73+
Client = null;
74+
timeout = string.Empty;
75+
proxytype = string.Empty;
76+
country = string.Empty;
77+
anonymity = string.Empty;
78+
ssl = string.Empty;
79+
}
4080
}
4181
}

ProxyGrabber/Information.Designer.cs

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ProxyGrabber/Information.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ private void InstagramPicBox_Click(object sender, EventArgs e)
2525
private void ExitBtn_Click(object sender, EventArgs e)
2626
{
2727
this.Close();
28+
GC.Collect();
2829
}
2930

3031
public const int WM_NCLBUTTONDOWN = 0xA1;

ProxyGrabber/MainForm.Designer.cs

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ProxyGrabber/MainForm.cs

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,35 @@ public MainForm()
1313
InitializeComponent();
1414
}
1515

16+
private string timeout;
17+
private string proxytype;
18+
private string country;
19+
private string anonymity;
20+
private string ssl;
21+
webAPI API = new webAPI();
22+
Information InfoDialog = new Information();
1623
private void MainForm_Load(object sender, EventArgs e)
1724
{
18-
TimeoutSta.Text = "Timeout: " + Convert.ToString(TimeoutTbar.Value) + "ms";
19-
amountUpdate();
25+
TimeoutLbl.Text = "Timeout: " + Convert.ToString(TimeoutTbar.Value) + "ms";
26+
2027
TypeCmBox.SelectedIndex = 0;
2128
CountryCmBox.SelectedIndex = 0;
2229
AnonymityCmBox.SelectedIndex = 0;
2330
SSLCmBox.SelectedIndex = 0;
24-
}
2531

26-
webAPI API;
27-
private string timeout;
28-
private string proxytype;
29-
private string country;
30-
private string anonymity;
31-
private string ssl;
32+
AmountLbl.Text = "Amount: " + API.amountProxies();
33+
}
3234

3335
private void TimeoutTbar_Scroll(object sender, EventArgs e)
3436
{
3537
timeout = Convert.ToString(TimeoutTbar.Value);
36-
TimeoutSta.Text = "Timeout: " + timeout + "ms";
38+
TimeoutLbl.Text = "Timeout: " + timeout + "ms";
3739
}
3840

3941
private void TimeoutTbar_MouseCaptureChanged(object sender, EventArgs e)
4042
{
41-
amountUpdate();
43+
API.setTimeout(timeout);
44+
AmountLbl.Text = "Amount: " + API.amountProxies();
4245
}
4346

4447
private void TypeCmBox_SelectedIndexChanged(object sender, EventArgs e)
@@ -56,31 +59,34 @@ private void TypeCmBox_SelectedIndexChanged(object sender, EventArgs e)
5659
AnonymityCmBox.Enabled = true;
5760
SSLCmBox.Enabled = true;
5861
}
59-
timeUpdate();
60-
amountUpdate();
62+
API.setProxyType(proxytype);
63+
LastUpdatedLbl.Text = "Last updated: " + API.lastUpdated();
64+
AmountLbl.Text = "Amount: " + API.amountProxies();
6165
}
6266

6367
private void CountryCmBox_SelectedIndexChanged(object sender, EventArgs e)
6468
{
6569
country = Convert.ToString(CountryCmBox.SelectedItem);
66-
amountUpdate();
70+
API.setCountry(country);
71+
AmountLbl.Text = "Amount: " + API.amountProxies();
6772
}
6873

6974
private void AnonymityCmBox_SelectedIndexChanged(object sender, EventArgs e)
7075
{
7176
anonymity = Convert.ToString(AnonymityCmBox.SelectedItem);
72-
amountUpdate();
77+
API.setAnonymity(anonymity);
78+
AmountLbl.Text = "Amount: " + API.amountProxies();
7379
}
7480

7581
private void SSLCmBox_SelectedIndexChanged(object sender, EventArgs e)
7682
{
7783
ssl = Convert.ToString(SSLCmBox.SelectedItem);
78-
amountUpdate();
84+
API.setSSL(ssl);
85+
AmountLbl.Text = "Amount: " + API.amountProxies();
7986
}
8087

8188
private void SaveBtn_Click(object sender, EventArgs e)
8289
{
83-
APIReq();
8490
if (SaveProxies.ShowDialog() == DialogResult.OK)
8591
{
8692
API.Download(SaveProxies.FileName);
@@ -94,6 +100,10 @@ private void LogoPicBox_Click(object sender, EventArgs e)
94100

95101
private void ExitBtn_Click(object sender, EventArgs e)
96102
{
103+
API.Dispose();
104+
API = null;
105+
InfoDialog = null;
106+
GC.Collect();
97107
Application.Exit();
98108
}
99109

@@ -104,27 +114,9 @@ private void MiniBtn_Click(object sender, EventArgs e)
104114

105115
private void InfoBtn_Click(object sender, EventArgs e)
106116
{
107-
Information InfoDialog = new Information();
108117
InfoDialog.ShowDialog();
109118
}
110119

111-
public void timeUpdate()
112-
{
113-
APIReq();
114-
upChkSta.Text = "Last updated: " + API.Lastupdated();
115-
}
116-
117-
public void amountUpdate()
118-
{
119-
APIReq();
120-
AmountSta.Text = "Amount: " + API.AmountProxies();
121-
}
122-
123-
public void APIReq()
124-
{
125-
API = new webAPI(timeout, proxytype, country, anonymity, ssl);
126-
}
127-
128120
public const int WM_NCLBUTTONDOWN = 0xA1;
129121
public const int HT_CAPTION = 0x2;
130122
[DllImportAttribute("user32.dll")]

ProxyGrabber/MainForm.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<metadata name="SaveProxies.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123+
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
124+
<value>62</value>
125+
</metadata>
123126
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
124127
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
125128
<value>

ProxyGrabber/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("1.1.0.0")]
36+
[assembly: AssemblyFileVersion("1.1.0.0")]

0 commit comments

Comments
 (0)