public NeedleResult GetNeedle(NeedleKey needle) { NeedleResult result = null; needles.TryGetValue(needle, out result); return(result); }
public override void Run() { var cached = true; this.searchResult = state.GetOrAddNeedle(needle, () => { cached = false; var image = state.Image(needle.Key).Clone(); var magnification = 0.1; image.Resize(new Percentage(magnification * 100)); var result = FindHighEntropyStrip(image, needle.Gravity, NeedleSize * magnification, this); result.Point.X /= magnification; result.Point.Y /= magnification; return(result); }); var resultLabel = $"Not found ({searchResult.Entropy})"; if (searchResult.MeetsThreshold()) { resultLabel = $"Found at ({searchResult.Point}), {searchResult.Entropy}"; } Complete(resultLabel, cached); }