public async Task AddPluginAsync(IBlacklist blacklistPlugin) { this.Logger.LogInfo("Initializes blacklist plugin \"" + blacklistPlugin.GetType().FullName + "\"."); if (blacklistPlugin is IInitializable initializable) { await initializable.InitializeAsync(); } BlacklistCollection collection; if (this.plugins.ContainsKey(typeof(IBlacklist))) { collection = (BlacklistCollection)this.plugins[typeof(IBlacklist)]; } else { this.plugins.Add(typeof(IBlacklist), collection = new BlacklistCollection()); } collection.Add(blacklistPlugin); this.Logger.LogInfo("Plugin \"" + blacklistPlugin.GetType().FullName + "\" ready to use."); }
public FollowRouteGoal(ILogger logger, ConfigurableInput input, PlayerReader playerReader, IPlayerDirection playerDirection, List <WowPoint> points, StopMoving stopMoving, NpcNameFinder npcNameFinder, IBlacklist blacklist, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather) { this.logger = logger; this.input = input; this.playerReader = playerReader; this.playerDirection = playerDirection; this.stopMoving = stopMoving; this.pointsList = points; this.npcNameFinder = npcNameFinder; this.blacklist = blacklist; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; this.pather = pather; if (classConfiguration.Mode != Mode.AttendedGather) { AddPrecondition(GoapKey.incombat, false); } }
public AdhocNPCGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, KeyAction key, IBlacklist blacklist) { this.playerReader = playerReader; this.wowProcess = wowProcess; this.playerDirection = playerDirection; this.stopMoving = stopMoving; this.logger = logger; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; this.pather = pather; this.key = key; this.blacklist = blacklist; if (key.InCombat == "false") { AddPrecondition(GoapKey.incombat, false); } else if (key.InCombat == "true") { AddPrecondition(GoapKey.incombat, true); } this.Keys.Add(key); }
public CrearNube() { _blacklist = _blacklist = new BannedWords(); _progress = new ProgressBarWrapper(); }
public GoapAgent(PlayerReader playerReader, HashSet <GoapGoal> availableGoals, IBlacklist blacklist, ILogger logger, ClassConfiguration classConfiguration) { this.playerReader = playerReader; this.AvailableGoals = availableGoals.OrderBy(a => a.CostOfPerformingAction); this.blacklist = blacklist; this.logger = logger; this.planner = new GoapPlanner(logger); this.classConfiguration = classConfiguration; }
public GoapAgent(ILogger logger, GoapAgentState goapAgentState, ConfigurableInput input, AddonReader addonReader, HashSet <GoapGoal> availableGoals, IBlacklist blacklist) { this.logger = logger; this.GoapAgentState = goapAgentState; this.input = input; this.addonReader = addonReader; this.playerReader = addonReader.PlayerReader; this.addonReader.CreatureHistory.KillCredit -= OnKillCredit; this.addonReader.CreatureHistory.KillCredit += OnKillCredit; this.stopMoving = new StopMoving(input, playerReader); this.AvailableGoals = availableGoals.OrderBy(a => a.CostOfPerformingAction); this.blacklist = blacklist; this.planner = new GoapPlanner(logger); }
public AdhocNPCGoal(ILogger logger, ConfigurableInput input, PlayerReader playerReader, IPlayerDirection playerDirection, StopMoving stopMoving, NpcNameFinder npcNameFinder, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, KeyAction key, IBlacklist blacklist) { this.logger = logger; this.input = input; this.playerReader = playerReader; this.playerDirection = playerDirection; this.stopMoving = stopMoving; this.npcNameFinder = npcNameFinder; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; this.pather = pather; this.key = key; this.blacklist = blacklist; if (key.InCombat == "false") { AddPrecondition(GoapKey.incombat, false); } else if (key.InCombat == "true") { AddPrecondition(GoapKey.incombat, true); } this.Keys.Add(key); }
public HashSet <GoapGoal> CreateGoals(ClassConfiguration classConfig, IBlacklist blacklist) { var availableActions = new HashSet <GoapGoal>(); List <WowPoint> pathPoints, spiritPath; GetPaths(out pathPoints, out spiritPath, classConfig); var playerDirection = new PlayerDirection(logger, input, addonReader.PlayerReader); var stopMoving = new StopMoving(input, addonReader.PlayerReader); var castingHandler = new CastingHandler(logger, input, addonReader.PlayerReader, classConfig, playerDirection, npcNameFinder); var stuckDetector = new StuckDetector(logger, input, addonReader.PlayerReader, playerDirection, stopMoving); var followRouteAction = new FollowRouteGoal(logger, input, addonReader.PlayerReader, playerDirection, pathPoints, stopMoving, npcNameFinder, blacklist, stuckDetector, classConfig, pather); var walkToCorpseAction = new WalkToCorpseGoal(logger, input, addonReader.PlayerReader, playerDirection, spiritPath, pathPoints, stopMoving, stuckDetector, pather); availableActions.Clear(); if (classConfig.Mode == Mode.CorpseRun) { availableActions.Add(new WaitGoal(logger)); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, input, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else if (classConfig.Mode == Mode.AttendedGather) { availableActions.Add(followRouteAction); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, input, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else { if (classConfig.Mode == Mode.AttendedGrind) { availableActions.Add(new WaitGoal(logger)); } else { availableActions.Add(followRouteAction); availableActions.Add(walkToCorpseAction); } availableActions.Add(new ApproachTargetGoal(logger, input, addonReader.PlayerReader, stopMoving, stuckDetector)); if (classConfig.WrongZone.ZoneId > 0) { availableActions.Add(new WrongZoneGoal(addonReader.PlayerReader, input, playerDirection, logger, stuckDetector, classConfig)); } if (classConfig.Parallel.Sequence.Count > 0) { availableActions.Add(new ParallelGoal(logger, input, addonReader.PlayerReader, stopMoving, classConfig.Parallel.Sequence, castingHandler)); } if (classConfig.Loot) { var lootAction = new LootGoal(logger, input, addonReader.PlayerReader, addonReader.BagReader, stopMoving, classConfig, npcNameFinder); lootAction.AddPreconditions(); availableActions.Add(lootAction); if (classConfig.Skin) { availableActions.Add(new SkinningGoal(logger, input, addonReader.PlayerReader, addonReader.BagReader, addonReader.equipmentReader, stopMoving, classConfig, npcNameFinder)); } } try { var genericCombat = new CombatGoal(logger, input, addonReader.PlayerReader, stopMoving, classConfig, castingHandler); availableActions.Add(genericCombat); availableActions.Add(new PullTargetGoal(logger, input, addonReader.PlayerReader, npcNameFinder, stopMoving, castingHandler, stuckDetector, classConfig)); availableActions.Add(new CreatureKilledGoal(logger, addonReader.PlayerReader, classConfig)); availableActions.Add(new ConsumeCorpse(logger, addonReader.PlayerReader)); foreach (var item in classConfig.Adhoc.Sequence) { availableActions.Add(new AdhocGoal(logger, input, item, addonReader.PlayerReader, stopMoving, castingHandler)); } } catch (Exception ex) { logger.LogError(ex.ToString()); } foreach (var item in classConfig.NPC.Sequence) { availableActions.Add(new AdhocNPCGoal(logger, input, addonReader.PlayerReader, playerDirection, stopMoving, npcNameFinder, stuckDetector, classConfig, pather, item, blacklist)); item.Path.AddRange(ReadPath(item.Name, item.PathFilename)); } var pathProviders = availableActions.Where(a => a is IRouteProvider) .Cast <IRouteProvider>() .ToList(); this.RouteInfo = new RouteInfo(pathPoints, spiritPath, pathProviders, addonReader.PlayerReader); this.pather.DrawLines(new List <LineArgs>() { new LineArgs { Spots = pathPoints, Name = "grindpath", Colour = 2, MapId = addonReader.PlayerReader.ZoneId }, new LineArgs { Spots = spiritPath, Name = "spirithealer", Colour = 3, MapId = addonReader.PlayerReader.ZoneId } }); } return(availableActions); }
public static IEnumerable <string> Filter(this IEnumerable <string> terms, IBlacklist blacklist) { return (terms.Where( term => !blacklist.Countains(term))); }
public Boolean AttributeHasValue(UIExtension.TaskAttribute attrib, String value, IBlacklist exclusions) { var words = GetWords(attrib, exclusions, false); return(words.Find(x => x.Equals(value, StringComparison.CurrentCultureIgnoreCase)) != null); }
public GoapAgent(PlayerReader playerReader, HashSet <GoapAction> availableActions, IBlacklist blacklist, ILogger logger) { this.playerReader = playerReader; this.AvailableActions = availableActions.OrderBy(a => a.CostOfPerformingAction); this.blacklist = blacklist; this.logger = logger; this.planner = new GoapPlanner(logger); }
public FollowRouteAction(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, List <WowPoint> points, StopMoving stopMoving, NpcNameFinder npcNameFinder, IBlacklist blacklist, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration) { this.playerReader = playerReader; this.wowProcess = wowProcess; this.playerDirection = playerDirection; this.stopMoving = stopMoving; this.pointsList = points; this.npcNameFinder = npcNameFinder; this.blacklist = blacklist; this.logger = logger; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; AddPrecondition(GoapKey.incombat, false); }
private List <IWord> GetWordsParallely(IEnumerable <string> files, Language language, IBlacklist blacklist, IWordStemmer stemmer) { return(files .AsParallel() //.WithDegreeOfParallelism(0x8) .WithCancellation(m_CancelSource.Token) .WithCallback(DoProgress) .SelectMany(file => ByLanguageFactory.GetWordExtractor(language, file)) .Filter(blacklist) .CountOccurences() .GroupByStem(stemmer) .SortByOccurences() .AsEnumerable() .Cast <IWord>() .ToList()); }
public GoapAgent(ILogger logger, WowProcess wowProcess, ConfigurableInput input, PlayerReader playerReader, HashSet <GoapGoal> availableGoals, IBlacklist blacklist, ClassConfiguration classConfiguration, BagReader bagReader) { this.logger = logger; this.wowProcess = wowProcess; this.input = input; this.playerReader = playerReader; this.AvailableGoals = availableGoals.OrderBy(a => a.CostOfPerformingAction); this.blacklist = blacklist; this.planner = new GoapPlanner(logger); this.classConfiguration = classConfiguration; this.bagReader = bagReader; }
public HashSet <GoapGoal> CreateGoals(ClassConfiguration classConfig, IBlacklist blacklist) { var availableActions = new HashSet <GoapGoal>(); List <WowPoint> pathPoints, spiritPath; GetPaths(out pathPoints, out spiritPath, classConfig); var playerDirection = new PlayerDirection(addonReader.PlayerReader, wowProcess, logger); var stopMoving = new StopMoving(wowProcess, addonReader.PlayerReader); var castingHandler = new CastingHandler(wowProcess, addonReader.PlayerReader, logger, classConfig, playerDirection, NpcNameFinder); var stuckDetector = new StuckDetector(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger); var followRouteAction = new FollowRouteGoal(addonReader.PlayerReader, wowProcess, playerDirection, pathPoints, stopMoving, NpcNameFinder, blacklist, logger, stuckDetector, classConfig, pather); var walkToCorpseAction = new WalkToCorpseGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, pathPoints, stopMoving, logger, stuckDetector, pather); availableActions.Clear(); if (classConfig.Mode == Mode.CorpseRun) { availableActions.Add(new WaitGoal(logger)); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else if (classConfig.Mode == Mode.AttendedGather) { availableActions.Add(followRouteAction); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else { if (classConfig.Mode == Mode.AttendedGrind) { availableActions.Add(new WaitGoal(logger)); } else { availableActions.Add(followRouteAction); availableActions.Add(walkToCorpseAction); } availableActions.Add(new TargetDeadGoal(wowProcess, logger)); availableActions.Add(new ApproachTargetGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, stuckDetector, classConfig)); if (classConfig.WrongZone.ZoneId > 0) { availableActions.Add(new WrongZoneGoal(addonReader.PlayerReader, wowProcess, playerDirection, logger, stuckDetector, classConfig)); } if (classConfig.Parallel.Sequence.Count > 0) { availableActions.Add(new ParallelGoal(wowProcess, addonReader.PlayerReader, stopMoving, classConfig.Parallel.Sequence, castingHandler, logger)); } var lootAction = new LootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); if (classConfig.Loot) { lootAction = new PostKillLootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); } try { var genericCombat = new CombatGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, classConfig, castingHandler); availableActions.Add(genericCombat); availableActions.Add(new PullTargetGoal(wowProcess, addonReader.PlayerReader, NpcNameFinder, stopMoving, logger, castingHandler, stuckDetector, classConfig)); foreach (var item in classConfig.Adhoc.Sequence) { availableActions.Add(new AdhocGoal(wowProcess, addonReader.PlayerReader, stopMoving, item, castingHandler, logger)); } } catch (Exception ex) { logger.LogError(ex.ToString()); } var pathProviders = new List <IRouteProvider> { followRouteAction, walkToCorpseAction }; if (classConfig.VendorLocation.X > 0 && !string.IsNullOrEmpty(classConfig.VendorTargetKey)) { var vendorAction = new VendorGoal(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger, stuckDetector, classConfig, pather, this.addonReader.BagReader); availableActions.Add(vendorAction); pathProviders.Add(vendorAction); } else { logger.LogWarning("Vendor location or target key is not defined, so no vendoring when bags are full."); } if (classConfig.RepairLocation.X > 0 && !string.IsNullOrEmpty(classConfig.RepairTargetKey)) { var repairAction = new RepairGoal(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger, stuckDetector, classConfig, pather, this.addonReader.BagReader); availableActions.Add(repairAction); pathProviders.Add(repairAction); } else { availableActions.Add(new ItemsBrokenGoal(addonReader.PlayerReader, logger)); logger.LogWarning("Repair location or target key is not defined, so bot will stop if gear is red."); } this.RouteInfo = new RouteInfo(pathPoints, spiritPath, pathProviders, addonReader.PlayerReader); } return(availableActions); }
private void ProcessText() { if (!string.IsNullOrEmpty(New.passingText1)) { SQLiteConnection sqlite_conn = new SQLiteConnection("Data Source=" + New.passingText2 + "; Version=3; new=False;"); sqlite_conn.Open(); StringBuilder builder = new StringBuilder(); SQLiteCommand sqlite_cmd = new SQLiteCommand("Select data from messages where key_remote_jid like '60165489131%'", sqlite_conn); using (SQLiteDataReader sdr = sqlite_cmd.ExecuteReader()) { while (sdr.Read()) { builder.Append(sdr[0]); builder.Append(" "); } textBox.Text = builder.ToString(); } IBlacklist customBlacklist = CommonBlacklist.CreateFromTextFile(s_BlacklistTxtFileName); InputType inputType = ComponentFactory.DetectInputType(textBox.Text); IProgressIndicator progress = ComponentFactory.CreateProgressBar(inputType, progressBar); IEnumerable <string> terms = ComponentFactory.CreateExtractor(inputType, textBox.Text, progress); IEnumerable <IWord> words = terms .Filter(customBlacklist) .CountOccurences(); cloudControl.WeightedWords = words .SortByOccurences() .Cast <IWord>(); bmp = new Bitmap(cloudControl.Width, cloudControl.Height); cloudControl.DrawToBitmap(bmp, new System.Drawing.Rectangle(0, 0, cloudControl.Width, cloudControl.Height)); } else if (!string.IsNullOrEmpty(New.passingText9)) { SQLiteConnection sqlite_conn = new SQLiteConnection("Data Source=" + New.passingText9 + "; Version=3; new=False;"); sqlite_conn.Open(); StringBuilder builder = new StringBuilder(); SQLiteCommand sqlite_cmd = new SQLiteCommand("Select content from chat_history", sqlite_conn); using (SQLiteDataReader sdr = sqlite_cmd.ExecuteReader()) { while (sdr.Read()) { builder.Append(sdr[0]); builder.Append(" "); } textBox.Text = builder.ToString(); } IBlacklist customBlacklist = CommonBlacklist.CreateFromTextFile(s_BlacklistTxtFileName); InputType inputType = ComponentFactory.DetectInputType(textBox.Text); IProgressIndicator progress = ComponentFactory.CreateProgressBar(inputType, progressBar); IEnumerable <string> terms = ComponentFactory.CreateExtractor(inputType, textBox.Text, progress); IEnumerable <IWord> words = terms .Filter(customBlacklist) .CountOccurences(); cloudControl.WeightedWords = words .SortByOccurences() .Cast <IWord>(); bmp = new Bitmap(cloudControl.Width, cloudControl.Height); cloudControl.DrawToBitmap(bmp, new System.Drawing.Rectangle(0, 0, cloudControl.Width, cloudControl.Height)); } }
public void UnionWith(IBlacklist other) { this.m_ExcludedWordsHashSet.UnionWith(other); }
public AdhocNPCGoal(ILogger logger, ConfigurableInput input, AddonReader addonReader, IPlayerDirection playerDirection, StopMoving stopMoving, NpcNameTargeting npcNameTargeting, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, KeyAction key, IBlacklist blacklist, MountHandler mountHandler, Wait wait, ExecGameCommand exec) { this.logger = logger; this.input = input; this.addonReader = addonReader; this.playerReader = addonReader.PlayerReader; this.playerDirection = playerDirection; this.stopMoving = stopMoving; this.npcNameTargeting = npcNameTargeting; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; this.pather = pather; this.key = key; this.blacklist = blacklist; this.mountHandler = mountHandler; this.wait = wait; this.execGameCommand = exec; this.gossipReader = addonReader.GossipReader; if (key.InCombat == "false") { AddPrecondition(GoapKey.incombat, false); } else if (key.InCombat == "true") { AddPrecondition(GoapKey.incombat, true); } this.Keys.Add(key); }
public HashSet <GoapGoal> CreateGoals(ClassConfiguration classConfig, IBlacklist blacklist) { var availableActions = new HashSet <GoapGoal>(); List <WowPoint> pathPoints, spiritPath; GetPaths(out pathPoints, out spiritPath, classConfig); var playerDirection = new PlayerDirection(addonReader.PlayerReader, wowProcess, logger); var stopMoving = new StopMoving(wowProcess, addonReader.PlayerReader); var castingHandler = new CastingHandler(wowProcess, addonReader.PlayerReader, logger, classConfig, playerDirection, NpcNameFinder); var stuckDetector = new StuckDetector(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger); var followRouteAction = new FollowRouteGoal(addonReader.PlayerReader, wowProcess, playerDirection, pathPoints, stopMoving, NpcNameFinder, blacklist, logger, stuckDetector, classConfig); var walkToCorpseAction = new WalkToCorpseGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, pathPoints, stopMoving, logger, stuckDetector); this.RouteInfo = new RouteInfo(pathPoints, spiritPath, followRouteAction, walkToCorpseAction); availableActions.Clear(); if (classConfig.Mode == Mode.CorpseRun) { availableActions.Add(new WaitGoal(logger)); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else if (classConfig.Mode == Mode.AttendedGather) { availableActions.Add(followRouteAction); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else { availableActions.Add(new ItemsBrokenGoal(addonReader.PlayerReader, logger)); if (classConfig.Mode == Mode.AttendedGrind) { availableActions.Add(new WaitGoal(logger)); } else { availableActions.Add(followRouteAction); availableActions.Add(walkToCorpseAction); } availableActions.Add(new TargetDeadGoal(wowProcess, logger)); availableActions.Add(new ApproachTargetGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, stuckDetector, classConfig)); if (classConfig.WrongZone.ZoneId > 0) { availableActions.Add(new WrongZoneGoal(addonReader.PlayerReader, wowProcess, playerDirection, logger, stuckDetector, classConfig)); } if (classConfig.Parallel.Sequence.Count > 0) { availableActions.Add(new ParallelGoal(wowProcess, addonReader.PlayerReader, stopMoving, classConfig.Parallel.Sequence, castingHandler, logger)); } var lootAction = new LootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); if (classConfig.Loot) { lootAction = new PostKillLootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); } try { var genericCombat = new CombatGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, classConfig, castingHandler); availableActions.Add(genericCombat); availableActions.Add(new PullTargetGoal(wowProcess, addonReader.PlayerReader, NpcNameFinder, stopMoving, logger, castingHandler, stuckDetector, classConfig)); foreach (var item in classConfig.Adhoc.Sequence) { availableActions.Add(new AdhocGoal(wowProcess, addonReader.PlayerReader, stopMoving, item, castingHandler, logger)); } } catch (Exception ex) { logger.LogError(ex.ToString()); } } return(availableActions); }
public WebAnalyzerForm(IPassiveWebDriver webDriver, IProgressIndicator progressIndicator, IBlacklist customIgnorelist) { this.webDriver = webDriver; this.progressIndicator = progressIndicator; this.customIgnorelist = customIgnorelist; InitializeComponent(); }
public TargetFinder(ILogger logger, ConfigurableInput input, ClassConfiguration classConfig, Wait wait, PlayerReader playerReader, IBlacklist blacklist, NpcNameTargeting npcNameTargeting) { this.logger = logger; this.classConfig = classConfig; this.input = input; this.wait = wait; this.playerReader = playerReader; this.blacklist = blacklist; this.npcNameTargeting = npcNameTargeting; }
private void btn_Go_Click(object sender, EventArgs e) { // Used factory pattern here instead of DI because the user can change these at will during runtime. IWordStemmer stemmer = Factory.CreateWordStemmer(cb_grouping.Checked); IBlacklist blacklist = Factory.CreateBlacklist(cb_ignoreCommonwords.Checked); // Perform in another thread to keep the UI active and display animation to the user. DoWait(() => { var task = Task.Run(() => { using (var document = new UriExtractor(progressIndicator, webDriver.GetWebDriver()) { URI = new Uri(Normalize(txt_URL.Text)) }) { document.SearchTags.Clear(); document.SearchTags.AddRange(CustomSettings.SearchTagNames); document.ExcludeSymbolsRegEx = CustomSettings.RegExExcludeSymbols; _lastGroupOfWords = document .Filter(blacklist) .Filter(customIgnorelist) .OrderBy(w => w) // Sort alpabetically .CountOccurences() .GroupByStem(stemmer) .SortByOccurences() // Sort by occurences .ToList(); // Remove deffered execution as Extractor will be disposed after this method ends. // Compute top n words. var topWords = _lastGroupOfWords.Take(CustomSettings.TopNumberOfWords); SetWordList(topWords); DoLocal(() => ClearImageList()); var images = document.GetImages(); foreach (var image in images) { var imageObj = GetImage(image.Item1); if (imageObj == null) { continue; } DoLocal(() => imagesFromCurrentSite.Images.Add(image.Item1, imageObj)); DoLocal(() => lv_images.Items.Add(new ListViewItem(image.Item2, image.Item1) { ToolTipText = "Click the image to display full size." })); } } }); // Set callback to check for any errors during execution task.GetAwaiter().OnCompleted(() => { if (task.Exception != null) { DoLocal(() => MessageBox.Show(this, $"Sorry the following error occured while trying to execute your last request:\r\n {GetErrorMessage(task.Exception)}"), true); DoLocal(() => txt_URL.BackColor = Color.Red); } else { DoLocal(() => txt_URL.BackColor = Color.Green); } }); // Wait until the task is done so the progress bar doesn't go away. task.Wait(); }); }
public void UnionWith(IBlacklist other) { }
public void Add(IBlacklist plugin) { this.allPlugins.Add(plugin); }