private unsafe bool MatchRelativePath(RelativePath path) { var value = path.Value; var hasDirectorySeparators = value.IndexOf(Path.DirectorySeparatorChar) >= 0; var ptr = Marshal.StringToHGlobalAnsi(value); try { var range = new TextFragment(ptr, 0, value.Length, sizeof(byte)); var hit = _searchContainer.GetAsciiSearch() .FindFirst(range, OperationProgressTracker.None); if (hit.HasValue) { return(true); } if (!hasDirectorySeparators) { return(false); } // Replace '\' with '/' and try again var first = (byte *)ptr.ToPointer(); var last = first + value.Length; for (; first != last; first++) { if ((char)(*first) == Path.DirectorySeparatorChar) { *first = (byte)Path.AltDirectorySeparatorChar; } } // Search again hit = _searchContainer.GetAsciiSearch() .FindFirst(range, OperationProgressTracker.None); return(hit.HasValue); } finally { Marshal.FreeHGlobal(ptr); } }
protected override ICompiledTextSearch GetCompiledTextSearch(ICompiledTextSearchContainer container) { return(container.GetAsciiSearch()); }
protected override ICompiledTextSearch GetCompiledTextSearch(ICompiledTextSearchContainer container) { return container.GetAsciiSearch(); }