• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SearchData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BadRegex_NoMagicSpecifierShouldBeHandled

 public void BadRegex_NoMagicSpecifierShouldBeHandled()
 {
     Create("");
     var searchData = new SearchData(@"\V", SearchKind.ForwardWithWrap, SearchOptions.None);
     var result = _search.FindNext(searchData, _textBuffer.GetPoint(0), _wordNavigator);
     Assert.True(result.IsNotFound);
 }
开发者ID:wmchristie,项目名称:VsVim,代码行数:7,代码来源:SearchServiceTest.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: BadRegex_NoMagicSpecifierShouldBeHandled

 public void BadRegex_NoMagicSpecifierShouldBeHandled()
 {
     var snapshot = EditorUtil.CreateBuffer("hello world");
     var nav = _factory.Create<ITextStructureNavigator>();
     var searchData = new SearchData(SearchText.NewPattern(@"\V"), SearchKind.ForwardWithWrap, SearchOptions.None);
     var ret = _search.FindNext(searchData, snapshot.GetPoint(0), nav.Object);
     Assert.IsTrue(ret.IsNone());
 }
开发者ID:rride,项目名称:VsVim,代码行数:8,代码来源:SearchServiceTest.cs


示例4: EnumProc

 private static bool EnumProc(IntPtr hWnd, ref SearchData data)
 {
     var sb = new StringBuilder(1024);
     GetWindowText(hWnd, sb, sb.Capacity);
     if (sb.ToString().Contains(data.Title))
     {
     data.hWnd = hWnd;
     return false;    // Found the window
     }
     return true;
 }
开发者ID:ThomasAvery,项目名称:toggldesktop,代码行数:11,代码来源:win32.cs


示例5: BadRegex3

 public void BadRegex3()
 {
     var tss = MockObjectFactory.CreateTextSnapshot(42).Object;
     var nav = _factory.Create<ITextStructureNavigator>();
     _textSearch
         .Setup(x => x.FindNext(0, true, It.IsAny<FindData>()))
         .Throws(new InvalidOperationException())
         .Verifiable();
     var searchData = new SearchData(SearchText.NewStraightText("f("), SearchKind.ForwardWithWrap, SearchOptions.None);
     Assert.Throws<InvalidOperationException>(() => _search.FindNext(searchData, new SnapshotPoint(tss, 0), nav.Object));
     _factory.Verify();
 }
开发者ID:praveennet,项目名称:VsVim,代码行数:12,代码来源:SearchServiceTest.cs


示例6: Find

        public static IntPtr Find(int processId, string className)
        {
            SearchData sd = new SearchData
            {
                className = className,
                processId = (uint)processId,
                buffer = new StringBuilder(className == null ? 0 : className.Length)
            };

            EnumWindows(new EnumWindowsProc(EnumProc), ref sd);

            return sd.hWnd;
        }
开发者ID:Healix,项目名称:Gw2Launcher,代码行数:13,代码来源:FindWindow.cs


示例7: GetTags3

 public void GetTags3()
 {
     Init(lines: "foo is the bar", lastSearch: "foo");
     var data = new SearchData(SearchText.NewPattern("foo"), SearchKind.Forward, SearchOptions.None);
     _search
         .Setup(x => x.FindNext(data, _textBuffer.GetPoint(0), _nav.Object))
         .Returns(FSharpOption.Create(new SnapshotSpan(_textBuffer.CurrentSnapshot, 0, 3)));
     _search
         .Setup(x => x.FindNext(data, _textBuffer.GetPoint(3), _nav.Object))
         .Returns(FSharpOption<SnapshotSpan>.None);
     var ret = _taggerRaw.GetTags(new NormalizedSnapshotSpanCollection(new SnapshotSpan(_textBuffer.CurrentSnapshot, 0, _textBuffer.CurrentSnapshot.Length)));
     Assert.AreEqual(1, ret.Count());
     Assert.AreEqual(new SnapshotSpan(_textBuffer.CurrentSnapshot, 0, 3), ret.Single().Span);
 }
开发者ID:minhajuddin,项目名称:VsVim,代码行数:14,代码来源:HighlightIncrementalSearchTaggerTest.cs


示例8: Add

        /// <summary>
        /// Aggiunge alla tabella le informazioni relative al messaggio ricevuto da un vicino (e possibile candidato
        /// per essere inoltrato, se non duplicato) oppure generato dallo stesso nodo e pronto per l'invio ai vicini,
        /// restituendo true se sono state aggiunte in modo corretto, altrimenti false se l'id del messaggio era già
        /// presente in tabella (duplicato).
        /// </summary>
        /// <param name="msgId">L'id del messaggio pronto per l'eventuale invio ai vicini.</param>
        /// <param name="connectionId">L'eventuale identificativo della connessione di provenienza del messaggio.</param>
        /// <param name="searchRef">L'eventuale riferimento ai dati di ricerca.</param>
        /// <returns>true se l'id del messaggio non è un duplicato; in caso contrario false.</returns>
        /// <remarks>
        /// Il riferimento ai dati di ricerca viene utilizzato soltanto dal nodo in cui inizia la ricerca, poiché
        /// consente di raccogliere i risultati via via in arrivo dai vicini, pertanto è necessario impostarlo se
        /// la ricerca inizia nel nodo corrente, altrimenti deve essere impostato a null.
        /// </remarks>
        public bool Add(Guid msgId, string connectionId, SearchData searchRef)
        {
            if (!ContainsEntry(msgId))
            {
                m_InternalTable.Add(msgId, new Entry
                {
                    SourceConnection = connectionId,
                    SearchReference = searchRef,
                    InsertionTime = DateTime.Now
                });

                return true;
            }

            return false; // duplicato
        }
开发者ID:enzo3m,项目名称:P2P-DiscoveryService-WCF,代码行数:31,代码来源:ForwardingTable.cs


示例9: EnumProcCaptionEquals

        private static bool EnumProcCaptionEquals(IntPtr hWnd, ref SearchData data)
        {
            uint procId;
            GetWindowThreadProcessId(hWnd, out procId);
            if (data.ParentId != (int) procId)
                return true;

            var sb = new StringBuilder(1024);
            GetWindowText(hWnd, sb, sb.Capacity);
            if (sb.ToString().Equals(data.SearchString))
            {
                data.Handle = hWnd;
                return false; // Found the wnd, halt enumeration
            }
            return true;
        }
开发者ID:jnnpsubm,项目名称:YAR-Auth,代码行数:16,代码来源:FindWindow.cs


示例10: EnumProc

 public static bool EnumProc(IntPtr hWnd, ref SearchData data)
 {
     // Check classname and title
     // This is different from FindWindow() in that the code below allows partial matches
     StringBuilder sb = new StringBuilder(1024);
     GetClassName(hWnd, sb, sb.Capacity);
     if (sb.ToString().StartsWith(data.Wndclass))
     {
         sb = new StringBuilder(1024);
         GetWindowText(hWnd, sb, sb.Capacity);
         if (sb.ToString().StartsWith(data.Title))
         {
             data.hWnd = hWnd;
             return false;    // Found the wnd, halt enumeration
         }
     }
     return true;
 }
开发者ID:Choochet,项目名称:TDR7K,代码行数:18,代码来源:WndSearcher.cs


示例11: Search

        /// <summary>
        /// Questo metodo permette di interrogare un nodo di ricerca e di avviare eventualmente una nuova ricerca.
        /// Prima verifica se il nodo di ricerca interrogato possiede una o più risorse compatibili con le opzioni
        /// specificate ed eventualmente le aggiunge ai risultati da inviare al client. Successivamente, controlla
        /// se la cache del gestore delle ricerche contiene uno o più risultati relativi ad una ricerca uguale, ma
        /// non ancora scaduta, ed eventualmente aggiunge anche questi ai risultati da inviare al client. Nel caso
        /// in cui la cache del gestore delle ricerche non dovesse contenere nessun risultato che corrisponde alle
        /// opzioni specificate, inizia una nuova ricerca attraverso la rete dei nodi di ricerca, ma nel frattempo
        /// restituisce al client i risultati disponibili oppure una lista vuota.
        /// </summary>
        /// <param name="options">Le opzioni di ricerca specificate dal client.</param>
        /// <param name="addresses">Gli eventuali indirizzi che corrispondono alle opzioni di ricerca.</param>
        public void Search(SearchOptions options, out List<Uri> addresses)
        {
            WriteToLog("Search options: <{0}-{1}>", options.Name, options.Version);

            // Trova eventuali risorse disponibili in questo nodo di ricerca.
            List<Uri> found = m_ResourceCache.Search(
                delegate(Uri uri, IEnumerable<TaskPerformerInfo> resources)
                {
                    foreach (var resource in resources)
                    {
                        if (resource.Name == options.Name && resource.Version == options.Version)
                        {
                            return true;
                        }
                    }
                    return false;
                }
            ).ToList<Uri>();

            // Trova eventuali risorse disponibili in altri nodi di ricerca.
            SearchData data = new SearchData(options);
            SearchResult result;
            if (!m_SearchManager.TryEnqueueNewSearch(data, out result))
            {
                found.AddRange(result.FoundServices);   // ricerca già presente --> recupera risultati correnti
            }
            else
            {
                WriteToLog("Starting new search...");

                if (m_CommunicationHandler.CreateNewSearch(data))
                {
                    WriteToLog("New search started.");
                }
                else
                {
                    WriteToLog("Error starting new search.");

                    m_SearchManager.Remove(data);   // rollback
                }
            }

            addresses = found.ToHashSet<Uri>().ToList<Uri>();
        }
开发者ID:enzo3m,项目名称:P2P-DiscoveryService-WCF,代码行数:56,代码来源:ProcessingServiceFinder.cs


示例12: EnumProc

        public static bool EnumProc(IntPtr hWnd, ref SearchData data)
        {
            uint processId;
            GetWindowThreadProcessId(hWnd, out processId);

            if (processId == data.processId)
            {
                data.buffer.Length = 0;
                GetClassName(hWnd, data.buffer, data.buffer.Capacity + 1);

                if (data.className == null || data.buffer.ToString().Equals(data.className))
                {
                    data.hWnd = hWnd;
                    return false;
                }
            }

            return true;
        }
开发者ID:Healix,项目名称:Gw2Launcher,代码行数:19,代码来源:FindWindow.cs


示例13: RTreeClosestPoint

    public static Rhino.Commands.Result RTreeClosestPoint(RhinoDoc doc)
    {
        Rhino.DocObjects.ObjRef objref;
        var rc = Rhino.Input.RhinoGet.GetOneObject("select mesh", false, Rhino.DocObjects.ObjectType.Mesh, out objref);
        if (rc != Rhino.Commands.Result.Success)
          return rc;

        Mesh mesh = objref.Mesh();
        objref.Object().Select(false);
        doc.Views.Redraw();

        using (RTree tree = new RTree())
        {
          for (int i = 0; i < mesh.Vertices.Count; i++)
          {
        // we can make a C++ function that just builds an rtree from the
        // vertices in one quick shot, but for now...
        tree.Insert(mesh.Vertices[i], i);
          }

          while (true)
          {
        Point3d point;
        rc = Rhino.Input.RhinoGet.GetPoint("test point", false, out point);
        if (rc != Rhino.Commands.Result.Success)
          break;

        SearchData data = new SearchData(mesh, point);
        // Use the first vertex in the mesh to define a start sphere
        double distance = point.DistanceTo(mesh.Vertices[0]);
        Sphere sphere = new Sphere(point, distance * 1.1);
        if (tree.Search(sphere, SearchCallback, data))
        {
          doc.Objects.AddPoint(mesh.Vertices[data.Index]);
          doc.Views.Redraw();
          RhinoApp.WriteLine("Found point in {0} tests", data.HitCount);
        }
          }
        }
        return Rhino.Commands.Result.Success;
    }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:41,代码来源:ex_rtreeclosestpoint.cs


示例14: FindNextMulitple5

 public void FindNextMulitple5()
 {
     var tss = MockObjectFactory.CreateTextSnapshot(42).Object;
     var nav = _factory.Create<ITextStructureNavigator>();
     var data = new FindData("foo", tss, FindOptions.UseRegularExpressions | FindOptions.MatchCase, nav.Object);
     _textSearch
         .Setup(x => x.FindNext(10, true, data))
         .Returns(new SnapshotSpan(tss, 0, 3))
         .Verifiable();
     _textSearch
         .Setup(x => x.FindNext(3, true, data))
         .Returns(new SnapshotSpan(tss, 10, 3))
         .Verifiable();
     var searchData = new SearchData(SearchText.NewPattern("foo"), SearchKind.ForwardWithWrap, SearchOptions.None);
     var ret = _search.FindNextMultiple(searchData, new SnapshotPoint(tss, 10), nav.Object, 2);
     Assert.IsTrue(ret.IsSome());
     Assert.AreEqual(new SnapshotSpan(tss, 10, 3), ret.Value);
     _factory.Verify();
 }
开发者ID:rride,项目名称:VsVim,代码行数:19,代码来源:SearchServiceTest.cs


示例15: FindNext3

 public void FindNext3()
 {
     _settings.SetupGet(x => x.IgnoreCase).Returns(true).Verifiable();
     var data = new SearchData(SearchText.NewPattern("foo"), SearchKind.Forward, SearchOptions.None);
     AssertFindNext(data, "foo", FindOptions.MatchCase | FindOptions.UseRegularExpressions);
 }
开发者ID:rride,项目名称:VsVim,代码行数:6,代码来源:SearchServiceTest.cs


示例16: MoveToNextOccuranceOfWordAtCursor9

 public void MoveToNextOccuranceOfWordAtCursor9()
 {
     Create("  foo bar baz");
     var data = new SearchData(SearchText.NewPattern("foo"), SearchKind.ForwardWithWrap, SearchOptions.None);
     _vimData.LastSearchData = data;
     _statusUtil.Setup(x => x.OnError(Resources.NormalMode_NoWordUnderCursor)).Verifiable();
     _operations.MoveToNextOccuranceOfWordAtCursor(SearchKind.ForwardWithWrap, 1);
     _statusUtil.Verify();
     Assert.AreEqual(data, _vimData.LastSearchData);
 }
开发者ID:rride,项目名称:VsVim,代码行数:10,代码来源:CommonOperationsTest.cs


示例17: MoveToNextOccuranceOfLastSearch5

 public void MoveToNextOccuranceOfLastSearch5()
 {
     Create("foo bar", "foo");
     var data = new SearchData(SearchText.NewPattern("foo"), SearchKind.BackwardWithWrap, SearchOptions.None);
     AllowOutlineExpansion(verify: true);
     _vimData.LastSearchData = data;
     _operations.MoveToNextOccuranceOfLastSearch(1, false);
     Assert.AreEqual(_textView.GetLine(1).Start, _textView.GetCaretPoint());
     _outlining.Verify();
 }
开发者ID:rride,项目名称:VsVim,代码行数:10,代码来源:CommonOperationsTest.cs


示例18: MoveToNextOccuranceOfLastSearch3

 public void MoveToNextOccuranceOfLastSearch3()
 {
     Create("foo bar", "foo");
     AllowOutlineExpansion();
     var data = new SearchData(SearchText.NewPattern("foo"), SearchKind.ForwardWithWrap, SearchOptions.None);
     _vimData.LastSearchData = data;
     _operations.MoveToNextOccuranceOfLastSearch(2, false);
     Assert.AreEqual(0, _textView.GetCaretPoint());
 }
开发者ID:rride,项目名称:VsVim,代码行数:9,代码来源:CommonOperationsTest.cs


示例19: MoveToNextOccuranceOfLastSearch1

 public void MoveToNextOccuranceOfLastSearch1()
 {
     Create("foo bar baz");
     var data = new SearchData(SearchText.NewPattern("beat"), SearchKind.ForwardWithWrap, SearchOptions.None);
     _vimData.LastSearchData = data;
     _statusUtil.Setup(x => x.OnError(Resources.Common_PatternNotFound("beat"))).Verifiable();
     _operations.MoveToNextOccuranceOfLastSearch(1, false);
     _statusUtil.Verify();
 }
开发者ID:rride,项目名称:VsVim,代码行数:9,代码来源:CommonOperationsTest.cs


示例20: WaitForDialogAndClickButton

		/// <summary>
		/// Waits for a dialog and clicks the button specified.
		/// Use Spy++ to find the captions of the button's you want to click. Note that some buttons include an accelerator & which should be included.
		/// </summary>
		/// <param name="dialogCaption">The caption of the dialog on which the button exists</param>
		/// <param name="buttonCaption">The caption of the button (including any accelerator keys)</param>
		/// <param name="timeout">length of time to wait before we time out</param>
		/// <returns>True if the button was clicked, false otherwise</returns>
		protected bool WaitForDialogAndClickButton (CancellationToken token, string dialogCaption, string buttonCaption = null, int timeout = 30, string className = null)
		{
			var ts = new TimeSpan (0, 0, timeout);
			var dispatcher = System.Windows.Application.Current.Dispatcher;
			var start = DateTime.Now;
			var sw = new Stopwatch ();
			sw.Start ();
			try {
				// we want to keep looping until we find the window and button we are after or
				// the timeout exxpires
				while (true) {
					SearchData sd = new SearchData { Wndclass = className, Title = dialogCaption, ButtonCaption = buttonCaption };
					EnumWindows (new EnumWindowsProc (EnumProc), ref sd);
					IntPtr window = sd.hWnd;
					if (window != IntPtr.Zero) {
						IntPtr button = IntPtr.Zero;
						if (!string.IsNullOrEmpty(buttonCaption)) {
							button = FindWindowEx (window, IntPtr.Zero, "Button", buttonCaption); 
							if (button != IntPtr.Zero) {
								SendMessage (button, WM_LBUTTONDOWN, 0, 0);
								SendMessage (button, WM_LBUTTONUP, 0, 0);
								SendMessage (button, BM_SETSTATE, 1, 0);
								return true;
							}
						} else {
							SendMessage (window, WM_CLOSE, 0, 0);
							return true;
						}

					}
					System.Threading.Thread.Sleep (10);
					if (sw.ElapsedMilliseconds > ts.TotalMilliseconds || token.IsCancellationRequested) {
						break;
					}
				}
				return false;
			} finally {
				sw.Stop ();
			}
		}
开发者ID:MobileEssentials,项目名称:clide,代码行数:48,代码来源:VsHostedSpec.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SearchDescriptor类代码示例发布时间:2022-05-24
下一篇:
C# SearchCriteria类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap