Ejemplo n.º 1
0
        public override string[] IsMatch(WorkspaceResult result, string fragment, Stream stream)
        {
            var match = matcher.Match(fragment);

            if (match.Success)
            {
                int idx  = match.Index;
                var frag = fragment.Fragment(idx, 40, 40);
                if (seenFragments.Contains(frag))
                {
                    // we've seen this fragment recently, nerf it even if it matches
                    // should get rid of menu links referring to the same link over and over
                    seenFragments.Enqueue(frag);
                    return(EmptySet);
                }
                else
                {
                    // we haven't seen this yet
                    seenFragments.Enqueue(frag);

                    return(Utility.MakeTags(match.Groups.OfType <object>().Select(x => x.ToString())).Distinct().ToArray());
                }
            }
            else
            {
                // no matches
                return(EmptySet);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Try and match the fragment from the file
        /// </summary>
        /// <param name="fragment"></param>
        /// <returns></returns>
        public override string[] IsMatch(WorkspaceResult result, string fragment, Stream stream)
        {
            string value = GetFieldValue(FieldName, result);

            if (seenWindow.Contains(value))
            {
                return(EmptySet);
            }
            else
            {
                seenWindow.Enqueue(value);
                return(new string[1]);
            }
        }