Can sombody help me figure out how to do it?
First thing is: for example if the number of threads is 5, the problem is that it starts testing the accountList from 4 instead of 0. Secondly: I get duplicates of the last tested account and a lot of other duplicates!
BanProxy and Retry are switched off or on inside the checker.
First thing is: for example if the number of threads is 5, the problem is that it starts testing the accountList from 4 instead of 0. Secondly: I get duplicates of the last tested account and a lot of other duplicates!
Code:
int accountPosition, accountPosition1, proxyPosition, proxyPosition1;
//accountPosition1 = accountPosition + 1
//proxyPosition = proxyPosition + 1
[ThreadStatic]
private static bool BanProxy = false;
[ThreadStatic]
private static bool DontR = false;
[ThreadStatic]
private static bool Dont = false;
[ThreadStatic]
private static bool Retry = false;
public static List<string> accountLst = new List<string>();
public static List<string> proxyLst = new List<string>();
private void Button2_Click(object sender, EventArgs e)
{
int tCount = Convert.ToInt32(textBox2.Text);
if (checkBox1.Checked)
LoadProxies();
LoadAccounts();
for (int i = 0; i < tCount; i++)
{
var th = new Thread(() => Worker());
th.Start();
}
}
And here is the worker where the problem seems to come from. I tried everything I could think of without result.
public void Worker()
{
int j = Thread.CurrentThread.ManagedThreadId;
while (accountPosition < accountLst.Count - 1)
{
if (!DontR)
{
proxyCount++;
if (label7.InvokeRequired)
Invoke((MethodInvoker)(() => this.label7.Text = $"pCount : {proxyCount}"));
}
if (proxyPosition1 == proxyLst.Count)
{
//Thread.Sleep(timetoretestproxylist);
proxyPosition1 = 0;
}
proxyPosition = proxyPosition1;
if (!DontR)
proxyPosition1++;
do
{
if (!Dont & !Retry)
{
accountPostion = accountPostion1;
accountPostion1++;
}
if (richTextBox2.InvokeRequired)
Invoke((MethodInvoker)(() => richTextBox2.AppendText($"accountPostion: {accountPostion}, thread: {j}" + "\n")));
switch (Checker(accountLst[accountPostion], proxyLst[proxyPostion]))
{
case FAIL_KEY:
failCount++;
BanProxy = false;
if (label3.InvokeRequired)
Invoke((MethodInvoker)(() => label3.Text = $"Bad : {failCount}"));
break;
case SUCC_KEY:
successCount++;
BanProxy = false;
Invoke(new MethodInvoker(() =>
{
label1.Text = $"Success : {successCount}";
richTextBox1.AppendText(accountLst[v] + "\n");
}));
break;
case FREE_KEY:
freeCount++;
BanProxy = false;
if (label2.InvokeRequired)
Invoke((MethodInvoker)(() => label2.Text = $"Free : {freeCount}"));
break;
case BAN_KEY:
banCount++;
if (label4.InvokeRequired)
Invoke((MethodInvoker)(() => label4.Text = $"Ban : {banCount}"));
BanProxy = true;
break;
case RET_KEY:
retCount++;
Retry = true;
break;
default:
unknownCount++;
BanProxy = false;
if (label7.InvokeRequired)
Invoke((MethodInvoker)(() => label5.Text = $"Unknown : {unknownCount}"));
break;
}
if (Retry)
{
DontR = true;
break;
}
if (BanProxy)
{
Dont = true;
break;
}
globalCount++;
Invoke((MethodInvoker)(() =>
{
richTextBox2.AppendText(accountLst[accountPostion] + "\n");
label6.Text = $"Total : {globalCount}/{accountLst.Count}";
}));
DontR = false;
Dont = false;
} while (accountPostion < accountLst.Count - 1);
}
}
BanProxy and Retry are switched off or on inside the checker.