Yo people of MD today I am gonna make a tutorial on how to make a SM checker!
In this tutorial we are going to be using a WebClient, TextBox, Button and bgWorkers.
Lets start by adding a button, and two listview to the actual form. Names = import_button, lv_avail, lv_unavail.
So double click the button and write this code.
After that lets add 4 background workers. Double click on those so it makes the DoWork event.
Inside those events we can do two things, a redundant checker or call a void that checks the certain list.
But first lets sort the list.
Now lets do the easiest way and cleanest way to filter. To understand this you need to understand that each background worker runs on a different thread. If you called a void from the backgroundWorker it will run separately.
So lets make the void that will check.
THEN we but the code in the background worker.
Backgroundworker 1:
Backgroundworker 2:
Backgroundworker 3:
Backgroundworker 4:
Enjoy, this should work for you guys, very simple checker.
In this tutorial we are going to be using a WebClient, TextBox, Button and bgWorkers.
Lets start by adding a button, and two listview to the actual form. Names = import_button, lv_avail, lv_unavail.
So double click the button and write this code.
Code:
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Text Documents|*.txt|All Files|*.*";
ofd.ShowDialog();
string filename = ofd.FileName;
SortList(filename);
After that lets add 4 background workers. Double click on those so it makes the DoWork event.
Inside those events we can do two things, a redundant checker or call a void that checks the certain list.
But first lets sort the list.
Code:
List<string> l1 = new List<string>();
List<string> l2 = new List<string>();
List<string> l3 = new List<string>();
List<string> l4 = new List<string>();
public void SortList(string file)
{
string[] names = System.IO.File.ReadAllLines(file);
int list = 1;
for(int i = 0; i < name.Length; i++)
{
switch(list)
{
case 1:
l1.Add(name[i]);
case 2:
l2.Add(name[i]);
case 3:
l3.Add(name[i]);
case 4:
l4.Add(name[i]);
case 5:
l1.Add(name[i]);
list = 1;
}
list++;
}
//Start Background Workers
backgroundWorker1.RunWorkerAsync();
backgroundWorker2.RunWorkerAsync();
backgroundWorker3.RunWorkerAsync();
backgroundWorker4.RunWorkerAsync();
}
Now lets do the easiest way and cleanest way to filter. To understand this you need to understand that each background worker runs on a different thread. If you called a void from the backgroundWorker it will run separately.
So lets make the void that will check.
Code:
public void CheckList(List<string> names)
{
for(int i = 0; i < names.Count(); i++)
{
try
{
WebClient wc = new WebClient();
wc.DownloadString("https://instagram.com/" + names[i]);
lv_unavail.Invoke(new Action(() => lv_unavail.Items.Add(names[i])));
}
catch(Exception ex)
{
lv_avail.Invoke(new Action(() => lv_avail.Items.Add(names[i])));
}
}
}
THEN we but the code in the background worker.
Backgroundworker 1:
Code:
CheckList(l1);
Code:
CheckList(l2);
Code:
CheckList(l3);
Code:
CheckList(l4);
Enjoy, this should work for you guys, very simple checker.