1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| public async Task Checkall()
{
Task amis = Task.Run(async () => await Amis());
Task rang = Task.Run(async () => await Rang());
Task premium = Task.Run(async () => await Premium());
Task bannis = Task.Run(async () => await Bannis());
Task connecté = Task.Run(async () => await Connected());
await Task.WhenAll(amis, rang, premium, bannis, connecté);
}
public async Task Amis()
{
string url = "ftp://[ip]/public_html/Friend/" + Properties.Settings.Default.search1 + "_amis/";
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(url);
request.Credentials = new NetworkCredential("user", "pass");
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
using (FtpWebResponse response = (FtpWebResponse)await request.GetResponseAsync())
using (Stream stream = response.GetResponseStream())
using (StreamReader readuser = new StreamReader(stream))
{
int nb = -2;
while ((readuser.Peek() > -1))
{
await readuser.ReadLineAsync();
nb += 1;
}
monoFlat_LinkLabel1.Text = nb.ToString();
}
}
public async Task Rang()
{
string lol;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://upchat.fr/key/modo.php");
using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
using (Stream se = response.GetResponseStream())
using (StreamReader sr = new StreamReader(se))
lol = await sr.ReadToEndAsync();
string lal;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://upchat.fr/key/admin.php");
using (HttpWebResponse res = (HttpWebResponse)await req.GetResponseAsync())
using (Stream sa = res.GetResponseStream())
using (StreamReader sy = new StreamReader(sa))
lal = await sy.ReadToEndAsync();
if (lol.Contains(Properties.Settings.Default.search1))
{
monoFlat_Label8.Text = "Modérateur";
}
else if (lal.Contains(Properties.Settings.Default.search1))
{
monoFlat_Label8.Text = "Administrateur";
}
else
{
monoFlat_Label8.Text = "Utilisateur";
}
}
public async Task Premium()
{
string okuser;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://upchat.fr/Account/" + Properties.Settings.Default.search1 + "_Account.php");
using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
using (Stream sz = response.GetResponseStream())
using (StreamReader sr = new StreamReader(sz))
okuser = await sr.ReadToEndAsync();
if (okuser == "Disconnectednonorang 1" || okuser == "Connectednonorang 1")
{
monoFlat_Label9.Text = "Non";
}
else if (okuser == "Disconnectedyesnorang 1" || okuser == "Connectedyesnorang 1")
{
monoFlat_Label9.Text = "Oui";
}
}
public async Task Bannis()
{
string okuser;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://upchat.fr/Account/" + Properties.Settings.Default.search1 + "_Account.php");
using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
using (Stream su = response.GetResponseStream())
using (StreamReader sr = new StreamReader(su))
okuser = await sr.ReadToEndAsync();
if (okuser == "Disconnectednonorang 1" || okuser == "Connectednonorang 1")
{
monoFlat_Label10.Text = "Non";
}
else if (okuser == "Disconnectednoyesrang 1" || okuser == "Connectednoyesrang 1")
{
monoFlat_Label10.Text = "Oui";
}
}
public async Task Connected()
{
try
{
FtpWebRequest req = default(FtpWebRequest);
FtpWebResponse res = default(FtpWebResponse);
req = (FtpWebRequest)WebRequest.Create("ftp://[ip]/public_html/key/" + Properties.Settings.Default.search1 + "_Connected.php");
req.Credentials = new NetworkCredential("user", "pass");
using (res = (FtpWebResponse)await req.GetResponseAsync())
monoFlat_Label11.Text = "oui";
}
catch (Exception ex)
{
monoFlat_Label11.Text = "non";
}
} |