Show / Hide Table of Contents

Class OSUtils

Provides helper methods related to operating system functionality across multiple platforms.

Inheritance
Object
OSUtils
Namespace: NanoByte.Common.Native
Assembly: NanoByte.Common.dll
Syntax
public static class OSUtils : Object

Methods

ExpandVariables(String, IDictionary<String, String>)

Expands/substitutes any Unix-style environment variables in the string.

Declaration
public static string ExpandVariables(string value, IDictionary<string, string> variables)
Parameters
Type Name Description
String value

The string containing variables to be expanded.

IDictionary<String, String> variables

The list of variables available for expansion.

Returns
Type Description
String
Remarks

Supports default values for unset variables (${VAR-default}) and for unset or empty variables (${VAR:-default}).

ExpandVariables(String, StringDictionary)

Expands/substitutes any Unix-style environment variables in the string.

Declaration
public static string ExpandVariables(string value, StringDictionary variables)
Parameters
Type Name Description
String value

The string containing variables to be expanded.

StringDictionary variables

The list of variables available for expansion.

Returns
Type Description
String
Remarks

Supports default values for unset variables (${VAR-default}) and for unset or empty variables (${VAR:-default}).

PreventDisplayOff(String)

Asks the operating system not to turn off the display.

Declaration
public static IDisposable PreventDisplayOff(string reason)
Parameters
Type Name Description
String reason

Why the display should not be turned off.

Returns
Type Description
IDisposable

Call Dispose() to restore the original state.

PreventIdle(String)

Asks the operating system not to enter idle mode. Useful to avoid standby or hibernation during a long-running task.

Declaration
public static IDisposable PreventIdle(string reason)
Parameters
Type Name Description
String reason

Why the system should not enter idle mode.

Returns
Type Description
IDisposable

Call Dispose() to restore the original state.

In This Article
Back to top Copyright Bastian Eicher