• Hello
Search Results for

    Show / Hide Table of Contents

    Class AMonitor<TWatchedSubject>

    Abstract base class for monitors in a Unity environment.

    Inheritance
    System.Object
    AMonitor<TWatchedSubject>
    AndroidInstalledApplicationMonitor
    AndroidPackageFingerprintMonitor
    AndroidPackageHashMonitor
    AndroidPackageLibraryMonitor
    AndroidPackageSourceMonitor
    DesktopPackageSourceMonitor
    IOSPackageSourceMonitor
    DeviceTimeContinuousMonitor
    DeviceTimeEventMonitor
    GameTimeMonitor
    Implements
    IMonitor<TWatchedSubject>
    Namespace: GUPS.AntiCheat.Monitor
    Assembly: cs.temp.dll.dll
    Syntax
    public abstract class AMonitor<TWatchedSubject> : MonoBehaviour where TWatchedSubject : class, IWatchedSubject
    Type Parameters
    Name Description
    TWatchedSubject
    Remarks

    Provides the lifecycle (start, pause, resume, stop), a manual ForceRead() and ForceReadAsync(), and the observer pattern from for all concrete monitors.

    Fields

    ForceReadTimeoutSeconds

    Longest time ForceRead() blocks while is still false, in seconds.

    Declaration
    protected const double ForceReadTimeoutSeconds = 10
    Field Value
    Type Description
    System.Double

    Properties

    IsActive

    Gets a value indicating whether the monitor is active and should be running.

    Declaration
    public bool IsActive { get; }
    Property Value
    Type Description
    System.Boolean

    IsPaused

    Gets a value indicating whether the monitor is currently paused.

    Declaration
    public bool IsPaused { get; }
    Property Value
    Type Description
    System.Boolean

    IsStarted

    Gets a value indicating whether the monitor has been started and is currently running.

    Declaration
    public bool IsStarted { get; }
    Property Value
    Type Description
    System.Boolean

    Name

    Gets the display name of the monitor.

    Declaration
    public abstract String Name { get; }
    Property Value
    Type Description
    String

    Methods

    CompletedRead(IWatchedSubject)

    Returns a request whose finding is already stored.

    Declaration
    protected static SubjectRequest CompletedRead(IWatchedSubject _Subject)
    Parameters
    Type Name Description
    IWatchedSubject _Subject

    The finding.

    Returns
    Type Description
    SubjectRequest

    A request with already true.

    Dispose()

    Notifies all subscribed observers that the monitor has completed and clears the observer list.

    Declaration
    public void Dispose()

    ForceRead()

    Runs this monitor's check and returns the finding. Does not notify observers.

    Declaration
    public virtual IWatchedSubject ForceRead()
    Returns
    Type Description
    IWatchedSubject

    The finding, or null when the request is still waiting after the timeout.

    Remarks

    An immediate check overrides this and returns the subject. This base calls ForceReadAsync() and, when that request is not done yet, blocks until is set or ForceReadTimeoutSeconds seconds have passed. The finding is the same kind of subject this monitor publishes. Detectors and cheating events stay on the automatic path.

    ForceReadAsync()

    Starts this monitor's check and returns a request that is filled when it finishes. Does not notify observers.

    Declaration
    public virtual SubjectRequest ForceReadAsync()
    Returns
    Type Description
    SubjectRequest

    The read request. is set when the check finishes.

    Remarks

    An immediate check is before this call returns, because this method calls ForceRead(). A check that has to wait overrides this method and completes the request when it finishes. ForceRead() then blocks for at most ForceReadTimeoutSeconds seconds. Yield the request, or poll , then read .

    Notify(TWatchedSubject)

    Notifies all subscribed observers with the provided watched subject.

    Declaration
    public void Notify(TWatchedSubject _Subject)
    Parameters
    Type Name Description
    TWatchedSubject _Subject

    The watched subject to forward to observers.

    OnDestroy()

    Stops the monitor when the underlying is destroyed.

    Declaration
    protected virtual void OnDestroy()

    OnPause()

    Called when the monitor is paused. Override to provide custom pause behavior.

    Declaration
    protected virtual void OnPause()

    OnResume()

    Called when the monitor is resumed. Override to provide custom resume behavior.

    Declaration
    protected virtual void OnResume()

    OnStart()

    Called when the monitor is started. Override to provide custom start behavior.

    Declaration
    protected virtual void OnStart()

    OnStop()

    Called when the monitor is stopped. Override to provide custom stop behavior.

    Declaration
    protected virtual void OnStop()

    OnUpdate()

    Called on each Unity update while the monitor is started, not paused and active. Override to implement custom update behavior.

    Declaration
    protected virtual void OnUpdate()

    Pause()

    Pauses the monitor, temporarily suspending data collection without terminating it.

    Declaration
    public void Pause()

    Resume()

    Resumes the monitor after a pause.

    Declaration
    public void Resume()

    Start()

    Starts the monitor, beginning data collection and processing.

    Declaration
    public void Start()
    Remarks

    An inactive monitor stays stopped, so OnStart() does not publish.

    Stop()

    Stops the monitor and finalizes any cleanup.

    Declaration
    public void Stop()

    Subscribe(IObserver<TWatchedSubject>)

    Subscribes an observer to receive notifications from the monitor.

    Declaration
    public IDisposable Subscribe(IObserver<TWatchedSubject> _Observer)
    Parameters
    Type Name Description
    IObserver<TWatchedSubject> _Observer

    The observer to subscribe.

    Returns
    Type Description
    IDisposable

    An that unsubscribes the observer when disposed.

    WaitForForceRead()

    Waits one short slice while ForceRead() is blocked on a request that is not done yet.

    Declaration
    protected virtual bool WaitForForceRead()
    Returns
    Type Description
    System.Boolean

    false to stop waiting before ForceReadTimeoutSeconds elapses.

    Implements

    IMonitor<>

    See Also

    AntiCheatMonitor
    In This Article
    Back to top GuardingPearSoftware documentation