class MAGES::Utilities::GenericUtilities

Overview

Generic utilities. More…

class GenericUtilities
{
public:
    // classes

    class ClassToken;
    class ProfileScope;

    // methods

    static string GetExportPath();
    static Color Hex(string hex);
    static string SanitizeFileName(string fileName);
    static bool AnimatorHasState(Animator animator, string stateName);

    static async void RunTaskAndExecuteActionInMainThreadWhenFinished(
        this Task task,
        Action onCompleted
    );

    static async void RunTaskAndExecuteActionInMainThreadWhenFinished< TResult >(
        this Task task,
        Action onCompleted
    );

    static async Task DeepCopyAsync(this HttpRequestMessage originalRequest);
    static IEnumerator WaitAFrame();
};

Detailed Documentation

Generic utilities.

Methods

static string GetExportPath()

Returns the file export path.

Returns:

The file export path.

static Color Hex(string hex)

Creates a color from a hex string.

Parameters:

hex

The hex string.

Returns:

The created color.

static string SanitizeFileName(string fileName)

Sanitizes a file name and removes invalid characters.

Parameters:

fileName

The file name.

Returns:

The file name safe string.

static bool AnimatorHasState(Animator animator, string stateName)

Checks if an animator has a state.

Parameters:

animator

The animator.

stateName

The state to search for.

Returns:

A value indicating whether the animator has this state.

static async void RunTaskAndExecuteActionInMainThreadWhenFinished(
    this Task task,
    Action onCompleted
)

Runs a task and executes an action in the main thread when finished.

Parameters:

TResult

The task’s result.

task

The task to run.

onCompleted

The action to invoke when task is completed.

static async void RunTaskAndExecuteActionInMainThreadWhenFinished< TResult >(
    this Task task,
    Action onCompleted
)

Runs a task and executes an action in the main thread when finished.

Parameters:

TResult

The task’s result.

task

The task to run.

onCompleted

The action to invoke when task is completed.

static async Task DeepCopyAsync(this HttpRequestMessage originalRequest)

Deep copy an HttpRequestMessage.

Parameters:

originalRequest

The mesage to deep copy.

Returns:

The cloned message.

static IEnumerator WaitAFrame()

Waits for end of frame in runtime, or next frame in batch mode.

Returns:

Enumerator.