예제 #1
0
 public MemberSearchStrategy(ILanguage language, ApiVisibility apiVisibility, SearchRequest searchRequest,
                             IProducerConsumerCollection <SearchResult> resultQueue, MemberSearchKind searchKind = MemberSearchKind.All)
     : base(language, apiVisibility, searchRequest, resultQueue)
 {
     this.searchKind = searchKind;
 }
예제 #2
0
 public NamespaceSearchStrategy(SearchRequest request, IProducerConsumerCollection <SearchResult> resultQueue)
     : base(request, resultQueue)
 {
 }
예제 #3
0
        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;
                    }
                }
            }
        }
예제 #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);
            }
        }