public static void vote_subscribe(string[] args) { if((args.Length!=4) || ((args[0].ToLower() != "vote") && (args[0].ToLower() != "subscribe") && (args[0].ToLower() != "unsubscribe"))) { ConsoleLog.WriteLine("vote/subscribe list.txt articleid interval"); } string[] bots=System.IO.File.ReadAllLines(args[1]); foreach (string bot in bots) { if (bot.Contains("|")) { string[] pair=bot.Split('|'); ConsoleLog.WriteLine(pair[0]+"|"+pair[1]); NerZul.Core.Network.Bot nbot=new NerZul.Core.Network.Bot(pair[0],pair[1], "Opera/9.62 (Windows NT 6.1; U; ru) Presto/2.1.1","",0); bool ok=false; while(!ok) { try { if(nbot.Login()) { ConsoleLog.WriteLine("Logged in"); if(args[0].ToLower()=="vote") nbot.VoteArticle(int.Parse(args[2])); else if(args[0].ToLower()=="subscribe") nbot.SubscribeNewspaper(int.Parse(args[2])); else nbot.UnsubscribeNewspaper(int.Parse(args[2])); ok=true; } }catch (Exception e) { ConsoleLog.WriteLine("Vote error: " + e.Message); } if(!ok) System.Threading.Thread.Sleep(1000*int.Parse(args[3])); } System.Threading.Thread.Sleep(1000*int.Parse(args[3])); } } }
private void Gobutton_Click_1(object sender, EventArgs e) { string sLogin, sPassword, sFile, sLink; sLink = TopictextBox.Text; sFile = FiletextBox.Text; int iLink = 0; if (sFile.Length == 0) { MessageBox.Show("Не указан файл!"); return; } if (sLink.Length == 0) { MessageBox.Show("Отсуствует номер на статьи!"); return; } iLink = int.Parse(sLink); if (iLink.ToString() != sLink) { MessageBox.Show("Неверно задан номер статьи!"); return; } m_ssUsers = GetDict(sFile); if (m_ssUsers.Count == 0) { MessageBox.Show("В указанном файле ничего нет!"); return; } foreach (var d in m_ssUsers) { throw new NotImplementedException("Login not updated to email"); sLogin = d.Key; sPassword = d.Value; ConsoleLog.WriteLine(sLogin); NerZul.Core.Network.Bot bt = new NerZul.Core.Network.Bot(sLogin, sLogin, sPassword, false); try { if (!bt.Login()) { ConsoleLog.WriteLine("Wrong login or password!"); continue; } if(bt.GetLastResponse().Contains("dead")) { ConsoleLog.WriteLine("Possible dead!"); bt.Revive(); } } catch (System.Exception e1) { ConsoleLog.WriteLine(sLogin+": Possible dead!"); ConsoleLog.WriteLine(e1.Message); try { bt.Revive(); } catch (System.Exception e2) { ConsoleLog.WriteLine(sLogin+": Possible banned!"); ConsoleLog.WriteLine(e2.Message); continue; } } try { bt.VoteArticle(iLink); ConsoleLog.WriteLine(sLogin + ": voted!"); } catch (System.Exception e2) { ConsoleLog.WriteLine(e2.Message); continue; } } MessageBox.Show("Готово!"); }