public MemberSearchStrategy(ILanguage language, ApiVisibility apiVisibility, SearchRequest searchRequest,
                             IProducerConsumerCollection <SearchResult> resultQueue, MemberSearchKind searchKind = MemberSearchKind.All)
     : base(language, apiVisibility, searchRequest, resultQueue)
 {
     this.searchKind = searchKind;
 }
 public NamespaceSearchStrategy(SearchRequest request, IProducerConsumerCollection <SearchResult> resultQueue)
     : base(request, resultQueue)
 {
 }
        public LiteralSearchStrategy(ILanguage language, ApiVisibility apiVisibility, SearchRequest request,
                                     IProducerConsumerCollection <SearchResult> resultQueue)
            : base(language, apiVisibility, request, resultQueue)
        {
            var terms = request.Keywords;

            if (terms.Length == 1)
            {
                var lexer = new Lexer(new LATextReader(new System.IO.StringReader(terms[0])));
                var value = lexer.NextToken();

                if (value != null && value.LiteralValue != null)
                {
                    TypeCode valueType = Type.GetTypeCode(value.LiteralValue.GetType());
                    switch (valueType)
                    {
                    case TypeCode.Byte:
                    case TypeCode.SByte:
                    case TypeCode.Int16:
                    case TypeCode.UInt16:
                    case TypeCode.Int32:
                    case TypeCode.UInt32:
                    case TypeCode.Int64:
                    case TypeCode.UInt64:
                        searchTermLiteralType  = TypeCode.Int64;
                        searchTermLiteralValue = CSharpPrimitiveCast.Cast(TypeCode.Int64, value.LiteralValue, false);
                        break;

                    case TypeCode.Single:
                    case TypeCode.Double:
                    case TypeCode.String:
                        searchTermLiteralType  = valueType;
                        searchTermLiteralValue = value.LiteralValue;
                        break;
                    }
                }
            }
        }
Beispiel #4
0
        public MetadataTokenSearchStrategy(ILanguage language, ApiVisibility apiVisibility, SearchRequest request,
                                           IProducerConsumerCollection <SearchResult> resultQueue)
            : base(language, apiVisibility, request, resultQueue)
        {
            var terms = request.Keywords;

            if (terms.Length == 1)
            {
                int.TryParse(terms[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var token);
                searchTermToken = MetadataTokenHelpers.EntityHandleOrNil(token);
            }
        }