public SearchTask(State state, string haystack, NeedleKey needle) { this.haystack = haystack; this.needle = needle; this.state = state; Name = $"Searching {System.IO.Path.GetFileName(haystack)} for {needle}"; }
public NeedleResult GetNeedle(NeedleKey needle) { NeedleResult result = null; needles.TryGetValue(needle, out result); return(result); }
public void ClearNeedle(NeedleKey key) { lock (lockObject) { needles.Remove(key); } }
public void ClearSearch(string haystack, NeedleKey needle) { var changed = false; lock (lockObject) { changed = searchResults.Remove(SearchKey.Create(haystack, needle)); } if (changed) { NotifyChangeListeners(); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var x = (string)value; var tokens = x.Split(new char[] { '|' }, 2); if (tokens.Length != 2) { throw new ArgumentException("Tuple serialization must have two tokens separated by |"); } string item1 = tokens[0]; NeedleKey item2 = (NeedleKey)(converter.ConvertFrom(context, culture, tokens[1])); return(SearchKey.Create(item1, item2)); }
public SearchResult GetOrAddSearch(string haystack, NeedleKey needle, Func <SearchResult> f) { return(GetOrAddCached(searchResults, SearchKey.Create(haystack, needle), f)); }
public NeedleResult GetOrAddNeedle(NeedleKey needle, Func <NeedleResult> f) { return(GetOrAddCached(needles, needle, f)); }
public FindNeedleTask(State state, NeedleKey needle) { this.state = state; this.needle = needle; Name = $"Finding needle {needle}"; }