Class Utilities
Provides a few general utilities for ease of use
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public static class Utilities
Methods
ApplyUpdate(bool)
Applies a pending update
Declaration
public static void ApplyUpdate(bool silent)
Parameters
Type | Name | Description |
---|---|---|
bool | silent | A boolean indicating whether to silently update or not. |
CreateAccessibleDirectory(string)
Creates all directories and subdirectories in the specified path unless they already exist with permissions allowing access by everyone.
Declaration
public static void CreateAccessibleDirectory(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The directory to create. |
OpenFolder(string)
Opens the provided folder in the user's file explorer
Declaration
public static void OpenFolder(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The full path of the folder to open |
OpenUrl(string)
Opens the provided URL in the default web browser
Declaration
public static Process? OpenUrl(string url)
Parameters
Type | Name | Description |
---|---|---|
string | url | The URL to open |
Returns
Type | Description |
---|---|
Process | The process created to open the URL |
PrepareFirstLaunch()
Call this before even initializing the Core to make sure the folders required for operation are in place
Declaration
public static void PrepareFirstLaunch()
Restart(bool, TimeSpan, params string[])
Restarts the application
Declaration
public static void Restart(bool elevate, TimeSpan delay, params string[] extraArgs)
Parameters
Type | Name | Description |
---|---|---|
bool | elevate | Whether the application should be restarted with elevated permissions |
TimeSpan | delay | Delay in seconds before killing process and restarting |
string[] | extraArgs | A list of extra arguments to pass to Artemis when restarting |
Shutdown()
Attempts to gracefully shut down the application with a delayed kill to ensure the application shut down
This is required because not all SDKs shut down properly, it is too unpredictable to just assume we can gracefully shut down
Declaration
public static void Shutdown()
Events
RestartRequested
Occurs when the core has requested an application restart
Declaration
public static event EventHandler<RestartEventArgs>? RestartRequested
Event Type
Type | Description |
---|---|
EventHandler<RestartEventArgs> |
ShutdownRequested
Occurs when the core has requested an application shutdown
Declaration
public static event EventHandler? ShutdownRequested
Event Type
Type | Description |
---|---|
EventHandler |
UpdateRequested
Occurs when the core has requested a pending application update to be applied
Declaration
public static event EventHandler<UpdateEventArgs>? UpdateRequested
Event Type
Type | Description |
---|---|
EventHandler<UpdateEventArgs> |