public TwoChatsHandler(ChatSpammerSettings spammerSettings, IChatHandler chat1, IChatHandler chat2) { Settings = spammerSettings; UniqueIdentifier = RandomTextGenerator.Generate(4); string dateStr = string.Format("{0:dd.MM.yy_HH.mm.ss}", DateTime.Now); UsedFolder = ResourcesAndConsts.Instance().FolderForСorrespondenceAndLogs + "/" + dateStr + "__" + UniqueIdentifier; Directory.CreateDirectory(UsedFolder); Chat1 = chat1; Chat2 = chat2; if (spammerSettings.BotScenario != null) { BotScenario = spammerSettings.BotScenario.Clone() as IBotScenario; } }
public IChatHandler CreateChat1(ChatSpammerSettings settings) { string cacheFolder = cacheDirManager.GetFreeDir(); string proxy = null; if (settings.UseProxy) { proxy = _ProxyDispatcher.GetFreeProxy(); _ProxyDispatcher.SetProxyStatus(proxy, ProxyStatus.UsedNow); } ICustomBrowser browser = CustomBrowserFactory.CreateCustomBrowser( cacheFolder, proxy ); ChatHandler_WrapperForChatvdvoemBasicWorker res = new ChatHandler_WrapperForChatvdvoemBasicWorker(browser); res.CacheFolder = cacheFolder; res.ProxyStr = proxy; return(res); }
private void button_Click(object sender, RoutedEventArgs e) { if (disp != null) { return; } var botScenario = new BotScenario_ByDelegate((ctrl) => { ctrl.WaitMessagesCountInOneOfChats(3); ctrl.Chat1.SendMessage(new ChatMessage("НОЖ В ПЕЧЕНЬ - НИКТО НЕ ВЕЧЕН", true)); ctrl.Chat2.SendMessage(new ChatMessage("НОЖ В ПЕЧЕНЬ - НИКТО НЕ ВЕЧЕН", true)); }); botScenario = null;/////// ChatSpammerSettings settings = new ChatSpammerSettings( true, null, null, false, false, botScenario, 300 ); //var factory = new FactoryOfChatHandler_FromTwoFactories( // new FactoryOfChatHandler_2Chatvdvoem(AwesomiumCustomBrowserFactory.Instance()), // new FactoryOfChatHandler_SilentBot() // ); var factory = new FactoryOfChatHandler_2Chatvdvoem(AwesomiumCustomBrowserFactory.Instance()); disp = new DispatcherOfTwoChatsHandler( settings, factory ); disp.NeededWorkUnitsCount = 1; disp.SaveLog = true; disp.StartWork(); }
public DispatcherOfTwoChatsHandler(ChatSpammerSettings chatsSettings, IFactoryOfChatHandler factoryOfChatHandler) { ChatsSettings = chatsSettings.Clone() as ChatSpammerSettings; FactoryOfChatHandler = factoryOfChatHandler; }
public IChatHandler CreateChat2(ChatSpammerSettings settings) { return(CreateChat1(settings)); }