Show / Hide Table of Contents

Class LoopBasedSession

A wrapper class for communicating with the VISAB WebApi in games that sent data continously.

Inheritance
Object
LoopBasedSession
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: VISABConnector
Assembly: VISABConnector.dll
Syntax
public static class LoopBasedSession

Properties

| Improve this Doc View Source

SavedFile

The file that was created and saved by the VISAB WebApi. Contains the queried file if the statistics loop was initialized with queryFile: true.

Declaration
public static string SavedFile { get; }
Property Value
Type Description
String
| Improve this Doc View Source

Session

The underylying session that is used.

Declaration
public static IVISABSession Session { get; }
Property Value
Type Description
IVISABSession

Methods

| Improve this Doc View Source

CloseSessionAsync()

Closes the active session.

Declaration
public static async Task<bool> CloseSessionAsync()
Returns
Type Description
Task<Boolean>

True if session was closed

| Improve this Doc View Source

GetFileAsync()

Receives the written json file for the session.

Declaration
public static async Task<string> GetFileAsync()
Returns
Type Description
Task<String>

The written json file if successfully retrieved, empty string else

| Improve this Doc View Source

SendImagesAsync(IImageContainer)

Sends images using the current session.

Declaration
public static async Task<bool> SendImagesAsync(IImageContainer image)
Parameters
Type Name Description
IImageContainer image

The image to send

Returns
Type Description
Task<Boolean>

True if successfully sent

| Improve this Doc View Source

StartSessionAsync(String, String, Int32, Int32)

Starts a VISAB WebApi session.

Declaration
public static async Task<bool> StartSessionAsync(string game, string hostAdress = "http://localhost", int port = 2673, int requestTimeout = 5)
Parameters
Type Name Description
String game

The game for which to start the session

String hostAdress

The hostAdress of the VISAB WebApi

Int32 port

The port of the VISAB WebApi

Int32 requestTimeout

The request timeout to use

Returns
Type Description
Task<Boolean>

True if session was started

| Improve this Doc View Source

StartSessionAsync(IMetaInformation, String, Int32, Int32)

Starts a VISAB WebApi session.

Declaration
public static async Task<bool> StartSessionAsync(IMetaInformation metaInformation, string hostAdress = "http://localhost", int port = 2673, int requestTimeout = 5)
Parameters
Type Name Description
IMetaInformation metaInformation

The metainformation with which to initialize the session

String hostAdress

The hostAdress of the VISAB WebApi

Int32 port

The port of the VISAB WebApi

Int32 requestTimeout

The request timeout to use

Returns
Type Description
Task<Boolean>

True if session was started

| Improve this Doc View Source

StartStatisticsLoopAsync(Func<IStatistics>, Func<Boolean>, Int32, CancellationToken, Boolean, Boolean)

Starts an infinite loop of sending statistics to VISAB WebApi. This loop is cancelled if the cancellationToken is. After the loop is cancelled, closes the internal session with the VISAB WebApi.

Declaration
public static async void StartStatisticsLoopAsync(Func<IStatistics> statisticsFunc, Func<bool> shouldSend, int sentDelay, CancellationToken cancellationToken, bool breakOnFailed = true, bool queryFile = false)
Parameters
Type Name Description
Func<IStatistics> statisticsFunc

The function that will be invoked to get the statistics

Func<Boolean> shouldSend

The function that will be invoked to check if statistics should be sent. Statistics are sent if it evaluateds to true.

Int32 sentDelay

The miliseconds to sleep each time after statistics were sent

CancellationToken cancellationToken

The cancellation token which will be used to check if the loop should be cancelled

Boolean breakOnFailed

Whether to break out of the loop if sending statistics fails

Boolean queryFile

Whether to query the created file after the session was closed

Events

| Improve this Doc View Source

FileReceivedEvent

Event that will be invoked when a saved file is received. The argument is the json string of the saved file.

Declaration
public static event Action<string> FileReceivedEvent
Event Type
Type Description
Action<String>
| Improve this Doc View Source

MessageAddedEvent

Event that will be invoked when a log message should be written. The argument contains the message.

Declaration
public static event Action<string> MessageAddedEvent
Event Type
Type Description
Action<String>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX