Hello. There is a program that sends messages to friends, there are also several accounts and this is the code that sends 5 messages to id, which are loaded into the textBox from the file:

void Go() { var index = 0; api.Authorize(4562540, логин, пароль, Settings.All); foreach (var login in textBox6.Lines) { try { var id = int.Parse(login); textBox10.Text = api.Messages.Send(id, false, textBox12.Text).ToString(); label5.Text = "Отправлено: " + index.ToString(); System.Threading.Thread.Sleep(10000); if (index++ == 4) { break; } } catch (Exception) { } } } 

The question is how to break; after break; automatically substitute a new username and password in the textbox to start the new account again? Separately created a file with logins, separately with passwords. Login positions = password positions in files.

    2 answers 2

    I do not know C-like ones well, more precisely - I don’t know at all, last dealt with them 25 years ago, however ... What prevents you after var index=0 before calling the API to create another embedding cycle that will go through the lines in the files logins and passwords.

    On pseudocode, it looks like this:

     //инициализация открыть файл_паролей, файл_логинов //считываем по первой строке каждого файла считать_строку(логин, файл_логинов) считать_строку(пароль, файл_паролей) начало_цикла //вдруг забыли заполнить файл(ы) если (eof(файл паролей) или eof(файл паролей)) то прервать_цикл твой foreach... //читаем следующую пару строк. Если уже прочли последнюю, то будет eof и цикл закончится считать_строку(логин, файл_логинов) считать_строку(пароль, файл_паролей) повторять_пока not eof(файл_паролей) 
    • The answer is needed as a code. - inkorpus
    • @inkorpus Excuse me, how to read correctly from files and how to arrange while / until loops are the basics of the language. I wrote you an algorithm, and the implementation is already yours. Maybe you should look at the description of the language in the section "cycle operators"? - Troublemaker-DV

    funny question, mocked. What is observed? judging by the names of the controls - this is a fragment of the deassembled (ie, someone else's) code. and this code is artificially slowed down and limited in the number of attempts. And also we see the impracticable desire of the author of the question to remove this restriction)))) Oh, this is a terrible word BREAK