Beispiel #1
0
 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}";
 }
Beispiel #2
0
        public NeedleResult GetNeedle(NeedleKey needle)
        {
            NeedleResult result = null;

            needles.TryGetValue(needle, out result);
            return(result);
        }
Beispiel #3
0
 public void ClearNeedle(NeedleKey key)
 {
     lock (lockObject)
     {
         needles.Remove(key);
     }
 }
Beispiel #4
0
        public void ClearSearch(string haystack, NeedleKey needle)
        {
            var changed = false;

            lock (lockObject)
            {
                changed = searchResults.Remove(SearchKey.Create(haystack, needle));
            }

            if (changed)
            {
                NotifyChangeListeners();
            }
        }
Beispiel #5
0
            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));
            }
Beispiel #6
0
 public SearchResult GetOrAddSearch(string haystack, NeedleKey needle, Func <SearchResult> f)
 {
     return(GetOrAddCached(searchResults, SearchKey.Create(haystack, needle), f));
 }
Beispiel #7
0
 public NeedleResult GetOrAddNeedle(NeedleKey needle, Func <NeedleResult> f)
 {
     return(GetOrAddCached(needles, needle, f));
 }
Beispiel #8
0
 public FindNeedleTask(State state, NeedleKey needle)
 {
     this.state  = state;
     this.needle = needle;
     Name        = $"Finding needle {needle}";
 }