Skip to content

OdinSearch_OutputConsumerBase

ShadowKnightMK4 edited this page Oct 17, 2023 · 1 revision

public abstract class OdinSearch_OutputConsumerBase

Hierarchy

  • OdinSearch_OutputConsumerBase
  • IDisposable

Description

The OdinSearch class Search Threads use this class to send output/communications to your code. This is the class one passes to OdinSearch to control what is done with the matches. To use this. Subclass it and override the Match routine plus any others.

Class Layout

Public Routines

Public Properties

  • public bool Disposed
  • public bool EnableNotMatchCall
  • public bool SearchOver
  • public Uint128 TimesMatchCalled
  • public Uint128 TimesNoMatchCalled
  • public Uint128 TimesBlockCalled
  • public Uint128 TimesMessageCalled

Protected Routines

Protected Properties

  • protected readonly Dictionary<string, object> CustomParameters

Possible Exceptions

ArgumentNotFoundException

HasPendingActions

public virtual bool HasPendingActions()

Description: If the class has pending stuff to do before reporting search is over, override this to give confirmation it's over. The Default Action is just it returns false.

Return Info: Returns a bool indicating if this class has pending actions to do or not.

Default Base Action: The default action always returns false which causes the OdinSearch class to figure the communication class is done.

ResolvePendingActions

public virtual bool ResolvePendingActions()

Description Fully Resolve any pending actions this class has do to.

Return Info return true if all actions are resolved

Default Base Action Always returns true as the default class does not need to do anything to resolve things.

GetCustomerParemterNames

public string[] GetCustomParameterNames()

Description: Get the names of set custom parameters for your class.

**Return Info: ** Returns an array containing make via ToArray() of the underlying Keys for the protected dictionary.

SetCustomParameter

SetCustomParameter(string name, object val)

Description: Set a custom argument

Argument string name is the name of the parameter to set. Use a string.

Argument object val is the object to get as the argument once set.

GetCustomParameter

public object GetCustomParameter(string name)

Description: Get the custom argument. Will throw an ArgumentNotFoundException if it does not exist.

Argument: string name is the name of the argument

Exceptions: ArgumentNotFoundException

Indexer

this[string name]

Description Indexor to access custom arguments in a class based on this class.

Argument: string ArgName is the name of the argument

Exceptions: ArgumentNotFoundException

WasNotMatched

public virtual void WasNotMatched(FileSystemInfo info)

Description: FUTURE: Called if a file item was accessed by OdinSearch but it did not match the search settings.

Argument: FileSystemInfo Info is the item that did not match the search settings.

Default Action Default will increase the TimesNoMatchCalled if it is not at the cap.

Match

public virtual void Match(FileSystemInfo info)

Description: This is called when an file system item matches the settings in OdinSearch.

Argument: FileSystemItem is the item that matched.

Default Action Default will increase the TimesMatchCalled if it is not at the cap.

Blocked

public virtual void Blocked(string Blocked)

Description: This is called when the search encounters an exception when attempting to examine a file/folder

Argument: Blocked is the file system path to the item in question that we could not access or there was an exception in OdinSearch that caused accessing it to not work.

Default Action Default will increase the TimesBlockCalled if it is not at the cap

Messaging

public virtual void Messaging(string Message)

Description: This is called with the search (OdinSearch) has text information to present that is not a block or filematch

Argument: string Message is the text information for the class to use.

Default Action: TimesMessageCalled is increased if not at the cap already.

SearchBegin

public virtual bool SearchBegin(DateTime Start)

Description: This is called once for each thread when the search is started by OdinSearch. It's called shortly before each thread starts.

Return Type: bool

Return Info: Return true if your communcation class needs this call for each thread starting or return false if just once is fine.

Exception Info InvalidOperationException can be thrown if a custom required arg is not existing. That should stop the search from starting.

Default Action Returns false

AllDone

public virtual void AllDone()

Description: OdinSearch calls this when all threads searching are done. Base just sets variable to true

Default Action: sets SearchOver flag to true.

Dispose

public virtual void Dispose()

Description: Default Disposal routine, will invoke ResolvePendingActions also.