Class PackageSearch
Namespace: ValveResourceFormat.IO
Assembly: ValveResourceFormat.dll
Finds package files by name, path or contents.
public static class PackageSearchInheritance
object ← PackageSearch
Methods
Find(Package, IReadOnlyCollection<PackageEntry>, PackageSearchQuery, IProgress<int>?, CancellationToken)
Returns the files that match a query, or all of them when its text is empty. Names match by file name, or by full path for PackageSearchType.FullPath or text with a slash. Contents are read in parallel in archive order, and for PackageSearchType.FileContents compiled resources are matched by their decompressed blocks, see Resource.AnyBlockContents(Stream, Func<ReadOnlySpan<byte>, bool>).
public static (List<PackageEntry> Matches, int NotSearched) Find(Package package, IReadOnlyCollection<PackageEntry> candidates, PackageSearchQuery query, IProgress<int>? progress = null, CancellationToken cancellationToken = default)Parameters
package Package
The package that holds the files.
candidates IReadOnlyCollection<PackageEntry>
The files to search.
query PackageSearchQuery
What to find.
progress IProgress<int>?
Receives how many of candidates a contents search has done, from any thread.
cancellationToken CancellationToken
Stops a contents search, which then returns the matches found so far.
Returns
(List<PackageEntry> Matches, int NotSearched)
The matches, and how many files could not be searched.
GetError(PackageSearchQuery)
Returns why the text of a query can not be searched, or null when it can.
public static string? GetError(PackageSearchQuery query)Parameters
query PackageSearchQuery
Returns
string?

