当前位置: 首页>>代码示例>>C#>>正文


C# SearchOptions类代码示例

本文整理汇总了C#中SearchOptions的典型用法代码示例。如果您正苦于以下问题:C# SearchOptions类的具体用法?C# SearchOptions怎么用?C# SearchOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SearchOptions类属于命名空间,在下文中一共展示了SearchOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInstance

        public IProcessText GetInstance(SearchOptions options)
        {
            IProcessText result = null;

            switch (options)
            {
                case (SearchOptions.QuickSearch):
                    result = new QuickSearchProcess();
                    break;
                case (SearchOptions.Horspool):
                    result = new HorspoolProcess();
                    break;
                case (SearchOptions.Sunday):
                    result = new SundayProcess();
                    break;
                case (SearchOptions.Raita):
                    result = new RaitaProcess();
                    break;
                case (SearchOptions.TunedBM):
                    result = new TunedBMProcess();
                    break;
                case (SearchOptions.BNDM):
                case (SearchOptions.Wildcard):
                    result = new BNDMProcess();
                    break;
                default:
                    return null;
            }
            return result;
        }
开发者ID:gitsyrob,项目名称:StringTools,代码行数:30,代码来源:ProcessTextFactory.cs

示例2: CreateFindOptions

 private FindOptions CreateFindOptions(string pattern, SearchKind kind, SearchOptions options)
 {
     var searchData = new SearchData(pattern, SearchOffsetData.None, kind, options);
     var serviceSearchData = _searchRaw.GetServiceSearchData(searchData, _wordNavigator);
     var findData = SearchService.ConvertToFindDataCore(serviceSearchData, _textBuffer.CurrentSnapshot);
     Assert.True(findData.IsResult);
     return findData.AsResult().FindOptions;
 }
开发者ID:Deleriumdoll,项目名称:VsVim,代码行数:8,代码来源:SearchServiceTest.cs

示例3: InitializeRunner

        private void InitializeRunner(string pattern, SearchOptions options)
        {
            if (options == SearchOptions.Unknown)
                options = SelectTheBestOption(pattern);

            IPreProcess preProcess = new PreProcessFactory().GetInstance(options);
            IProcessText processText = new ProcessTextFactory().GetInstance(options);
            _searchRunner = new SearchDispatch(processText, preProcess, pattern);
        }
开发者ID:gitsyrob,项目名称:StringTools,代码行数:9,代码来源:PatternFinder.cs

示例4: Search

        /// <summary>
        /// Searches Twitter with the the specified query.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="query">The query.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="TwitterSearchResultCollection"/> instance.
        /// </returns>
        public static TwitterResponse<TwitterSearchResultCollection> Search(OAuthTokens tokens, string query, SearchOptions options)
        {
            if (options == null)
                options = new SearchOptions();

            Commands.SearchCommand command = new Twitterizer.Commands.SearchCommand(tokens, query, options);

            TwitterResponse<TwitterSearchResultCollection> results =
                Core.CommandPerformer.PerformAction(command);

            return results;
        }
开发者ID:MrZweistein,项目名称:Twitterizer,代码行数:21,代码来源:TwitterSearch.cs

示例5: SearchParameters

        /// <summary>
        /// Initializes a new instance of the <see cref="T:SearchParameters" /> class.
        /// </summary>
        /// <param name="query">The search query.</param>
        /// <param name="documentTypeTags">The document type tags to include in the search, or <c>null</c>.</param>
        /// <param name="options">The search options.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="query"/> or one of the elements of <paramref name="documentTypeTags"/> (when the array is not <c>null</c>) are <c>null</c>.</exception>
        /// <exception cref="ArgumentException">If <paramref name="query"/> or one of the elements of <paramref name="documentTypeTags"/> (when the array is not <c>null</c>) are empty.</exception>
        public SearchParameters(string query, string[] documentTypeTags, SearchOptions options)
        {
            if(query == null) throw new ArgumentNullException("query");
            if(query.Length == 0) throw new ArgumentException("Query cannot be empty", "query");
            if(documentTypeTags != null) {
                if(documentTypeTags.Length == 0) throw new ArgumentException("DocumentTypeTags cannot be empty", "documentTypeTags");
                foreach(string dtt in documentTypeTags) {
                    if(dtt == null) throw new ArgumentNullException("documentTypeTags");
                    if(dtt.Length == 0) throw new ArgumentException("DocumentTypeTag cannot be empty", "documentTypeTag");
                }
            }

            this.query = PrepareQuery(query);
            this.documentTypeTags = documentTypeTags;
            this.options = options;
        }
开发者ID:mono,项目名称:ScrewTurnWiki,代码行数:24,代码来源:SearchParameters.cs

示例6: Validate

        public static SearchValidationResults Validate(SearchOptions options)
        {
            bool valid = true;
            List<SearchValidationErrors> errors = new List<SearchValidationErrors>();

            foreach (KeyValuePair<SearchFields, List<Condition>> pair in options.Conditions)
            {
                foreach (Condition cond in pair.Value)
                {
                    ValidationErrors error = TestFieldValue(pair.Key, cond);
                    if (error != ValidationErrors.NoErrors)
                    {
                        errors.Add(new SearchValidationErrors(cond, error));
                        valid = false;
                    }
                }
            }

            return new SearchValidationResults(valid, errors);
        }
开发者ID:lux01,项目名称:LibGatherer,代码行数:20,代码来源:SearchValidator.cs

示例7: FindNext

        public ISearchResult FindNext(SearchOptions options)
        {
            // insanity check
            Debug.Assert(searchStrategy      != null);
            Debug.Assert(documentIterator    != null);
            Debug.Assert(textIteratorBuilder != null);
            Debug.Assert(options             != null);

            if (info != null && textIterator != null && documentIterator.CurrentFileName != null) {
                if (info.FileName != documentIterator.CurrentFileName) { // create new iterator, if document changed
                    info         = documentIterator.Current;
                    textIterator = textIteratorBuilder.BuildTextIterator(info);
                } else { // old document -> initialize iterator position to caret pos
                    textIterator.Position = info.CurrentOffset;
                }

                ISearchResult result = CreateNamedSearchResult(searchStrategy.FindNext(textIterator, options));
                if (result != null) {
                    info.CurrentOffset = textIterator.Position;
                    return result;
                }
            }

            // not found or first start -> move forward to the next document
            if (documentIterator.MoveForward()) {
                info = documentIterator.Current;
                // document is valid for searching -> set iterator & fileName
                if (info != null && info.TextBuffer != null && info.EndOffset >= 0 && info.EndOffset < info.TextBuffer.Length) {
                    textIterator = textIteratorBuilder.BuildTextIterator(info);
                } else {
                    textIterator = null;
                }

                return FindNext(options);
            }
            return null;
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:37,代码来源:DefaultFind.cs

示例8: MatchName

 private bool MatchName(SearchOptions search)
 {
     return MatchText(search, Name);
 }
开发者ID:regan-sarwas,项目名称:ThemeManager3.1,代码行数:4,代码来源:TmNode.cs

示例9: Push

        public void Push(SearchOptions options)
        {
            try {
                 if (options == null)
                    return;

                _Stack.Push(options);
                SaveStack();
                Debug.WriteLine(STACK_FILE_NAME + ": Push: " + options.ToString());
            }
            catch (Exception ex) { Debug.WriteLine("\nStackMgr.Push " + ex.ToString()); }
            finally { /*Debug.WriteLine("Stack.Push finally block");*/ }
        }
开发者ID:mdavidov,项目名称:searchfiles-winstore,代码行数:13,代码来源:Stack.cs

示例10: SearchAsync

		/// <summary>
		/// Asynchronously searches the subset of UIDs in the folder for messages matching the specified query,
		/// returning them in the preferred sort order.
		/// </summary>
		/// <remarks>
		/// Asynchronously searches the folder for messages matching the specified query and ordering,
		/// returning only the requested search results.
		/// </remarks>
		/// <returns>The search results.</returns>
		/// <param name="options">The search options.</param>
		/// <param name="uids">The subset of UIDs</param>
		/// <param name="query">The search query.</param>
		/// <param name="orderBy">The sort order.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <para><paramref name="uids"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="query"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="orderBy"/> is <c>null</c>.</para>
		/// </exception>
		/// <exception cref="System.ArgumentException">
		/// <para>One or more of the <paramref name="uids"/> is invalid.</para>
		/// <para>-or-</para>
		/// <para><paramref name="orderBy"/> is empty.</para>
		/// </exception>
		/// <exception cref="System.NotSupportedException">
		/// <para>One or more search terms in the <paramref name="query"/> are not supported by the IMAP server.</para>
		/// <para>-or-</para>
		/// <para>The server does not support the ESORT extension.</para>
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="IMailStore"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="IMailStore"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="IMailStore"/> is not authenticated.
		/// </exception>
		/// <exception cref="FolderNotOpenException">
		/// The folder is not currently open.
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		/// <exception cref="ProtocolException">
		/// The server's response contained unexpected tokens.
		/// </exception>
		/// <exception cref="CommandException">
		/// The command failed.
		/// </exception>
		public virtual Task<SearchResults> SearchAsync (SearchOptions options, IList<UniqueId> uids, SearchQuery query, IList<OrderBy> orderBy, CancellationToken cancellationToken = default (CancellationToken))
		{
			if (uids == null)
				throw new ArgumentNullException ("uids");

			if (query == null)
				throw new ArgumentNullException ("query");

			if (orderBy == null)
				throw new ArgumentNullException ("orderBy");

			if (orderBy.Count == 0)
				throw new ArgumentException ("No sort order provided.", "orderBy");

			return Task.Factory.StartNew (() => {
				lock (SyncRoot) {
					return Search (options, uids, query, orderBy, cancellationToken);
				}
			}, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
		}
开发者ID:naeemkhedarun,项目名称:MailKit,代码行数:75,代码来源:MailFolder.cs

示例11: PerformSearch

        /// <summary>
        /// Performs a search.
        /// </summary>
        /// <param name="query">The search query.</param>
        /// <param name="fullText">A value indicating whether to perform a full-text search.</param>
        /// <param name="filesAndAttachments">A value indicating whether to search the names of files and attachments.</param>
        /// <param name="options">The search options.</param>
        /// <returns>The search results.</returns>
        /// <exception cref="ArgumentNullException">If <b>query</b> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">If <b>query</b> is empty.</exception>
        public SearchResultCollection PerformSearch(string query, bool fullText, bool filesAndAttachments, SearchOptions options)
        {
            if(query == null) throw new ArgumentNullException("query");
            if(query.Length == 0) throw new ArgumentException("Query cannot be empty", "query");

            return SearchTools.Search(query, fullText, filesAndAttachments, options);
        }
开发者ID:robhughadams,项目名称:screwturnwiki,代码行数:17,代码来源:Host.cs

示例12: Match

        internal bool Match(SearchOptions search)
        {
            if (search == null)
                return false;

            Debug.Assert(!string.IsNullOrEmpty(Path), "This Metadata object does not have a path");
            Debug.Assert(search.SearchType == SearchType.Metadata, "The search parameters are not appropriate for metadata");

            if (string.IsNullOrEmpty(search.XmlElement))
            {
                //to search the whole document, we don't need to parse it as XML
                string content = LoadAsText();
                return content != null && Match(content, search.SearchWords, search.FindAll, search.ComparisonMethod);
            }
            XDocument xDoc = LoadAsXDoc();
            if (xDoc == null)
                return false;
            return xDoc.Descendants(search.XmlElement)
                .Select(element => element.Value)
                .Where(value => !string.IsNullOrEmpty(value))
                .Any(value => Match(value, search.SearchWords, search.FindAll, search.ComparisonMethod));
        }
开发者ID:regan-sarwas,项目名称:ThemeManager3.1,代码行数:22,代码来源:Metadata.cs

示例13: MatchTags

 private bool MatchTags(SearchOptions search)
 {
     return MatchText(search, Tags);
 }
开发者ID:regan-sarwas,项目名称:ThemeManager3.1,代码行数:4,代码来源:TmNode.cs

示例14: Search

		/// <summary>
		/// Searches the subset of UIDs in the folder for messages matching the specified query,
		/// returning them in the preferred sort order.
		/// </summary>
		/// <remarks>
		/// Searches the folder for messages matching the specified query and ordering,
		/// returning only the requested search results.
		/// </remarks>
		/// <returns>The search results.</returns>
		/// <param name="options">The search options.</param>
		/// <param name="uids">The subset of UIDs</param>
		/// <param name="query">The search query.</param>
		/// <param name="orderBy">The sort order.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <para><paramref name="uids"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="query"/> is <c>null</c>.</para>
		/// <para>-or-</para>
		/// <para><paramref name="orderBy"/> is <c>null</c>.</para>
		/// </exception>
		/// <exception cref="System.ArgumentException">
		/// <para>One or more of the <paramref name="uids"/> is invalid.</para>
		/// <para>-or-</para>
		/// <para><paramref name="orderBy"/> is empty.</para>
		/// </exception>
		/// <exception cref="System.NotSupportedException">
		/// <para>One or more search terms in the <paramref name="query"/> are not supported by the IMAP server.</para>
		/// <para>-or-</para>
		/// <para>The IMAP server does not support the ESORT extension.</para>
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="ImapClient"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="ImapClient"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="ImapClient"/> is not authenticated.
		/// </exception>
		/// <exception cref="FolderNotOpenException">
		/// The <see cref="ImapFolder"/> is not currently open.
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		/// <exception cref="ImapProtocolException">
		/// The server's response contained unexpected tokens.
		/// </exception>
		/// <exception cref="ImapCommandException">
		/// The server replied with a NO or BAD response.
		/// </exception>
		public override SearchResults Search (SearchOptions options, IList<UniqueId> uids, SearchQuery query, IList<OrderBy> orderBy, CancellationToken cancellationToken = default (CancellationToken))
		{
			var set = ImapUtils.FormatUidSet (uids);
			var args = new List<string> ();
			string charset;

			if (query == null)
				throw new ArgumentNullException ("query");

			if (orderBy == null)
				throw new ArgumentNullException ("orderBy");

			if (orderBy.Count == 0)
				throw new ArgumentException ("No sort order provided.", "orderBy");

			CheckState (true, false);

			if ((Engine.Capabilities & ImapCapabilities.ESort) == 0)
				throw new NotSupportedException ("The IMAP server does not support the ESORT extension.");

			if ((Engine.Capabilities & ImapCapabilities.SortDisplay) == 0) {
				for (int i = 0; i < orderBy.Count; i++) {
					if (orderBy[i].Type == OrderByType.DisplayFrom || orderBy[i].Type == OrderByType.DisplayTo)
						throw new NotSupportedException ("The IMAP server does not support the SORT=DISPLAY extension.");
				}
			}

			if (uids.Count == 0)
				return new SearchResults ();

			var optimized = query.Optimize (new ImapSearchQueryOptimizer ());
			var expr = BuildQueryExpression (optimized, args, out charset);
			var order = BuildSortOrder (orderBy);
			var command = "UID SORT RETURN (";

			if ((options & SearchOptions.Count) != 0)
				command += "COUNT ";
			if ((options & SearchOptions.Min) != 0)
				command += "MIN ";
			if ((options & SearchOptions.Max) != 0)
				command += "MAX ";
			command = command.TrimEnd ();
			command += ") ";

			command += order + " " + charset + " UID " + set + " " + expr + "\r\n";
//.........这里部分代码省略.........
开发者ID:dcga,项目名称:MailKit,代码行数:101,代码来源:ImapFolder.cs

示例15: FindPlayerExact

 /// <summary> Finds player by name without autocompletion.
 /// Returns null if no player with the given name is online. </summary>
 /// <param name="player"> Player from whose perspective search is performed. Used to determine whether others are hidden. </param>
 /// <param name="name"> Full player name. Case-insensitive. </param>
 /// <param name="options"> Search options (IncludeHidden and IncludeSelf are applicable, other flags are ignored). </param>
 /// <returns> Player object if player was found online; otherwise null. </returns>
 public static Player FindPlayerExact( [NotNull] Player player, [NotNull] string name, SearchOptions options ) {
     Player target = Players.FirstOrDefault( p => p.Name.Equals( name, StringComparison.OrdinalIgnoreCase ) );
     bool includeHidden = (options & SearchOptions.IncludeHidden) != 0;
     bool includeSelf = (options & SearchOptions.IncludeSelf) != 0;
     if( target != null && !includeHidden && !player.CanSee( target ) || // hide players whom player cant see
         target == player && !includeSelf ) { // hide self, if applicable
         target = null;
     }
     return target;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:16,代码来源:Server.cs


注:本文中的SearchOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。