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


C# SearchData类代码示例

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


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


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