Class Platform
Runtime platform service.
Inheritance
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public static class Platform : Object
Properties
BatteryInfo
Gets the battery information.
Declaration
[Unmanaged]
public static BatteryInfo BatteryInfo { get; }
Property Value
BatteryInfo
|
CacheLineSize
Gets the CPU cache line size.
Declaration
[Unmanaged]
public static int CacheLineSize { get; }
Property Value
System.Int32
|
ClockFrequency
Gets the system clock frequency.
Declaration
[Unmanaged]
public static ulong ClockFrequency { get; }
Property Value
System.UInt64
|
ComputerName
Gets the computer machine name.
Declaration
[Unmanaged]
public static string ComputerName { get; }
Property Value
System.String
|
CPUInfo
Gets the CPU information.
Declaration
[Unmanaged]
public static CPUInfo CPUInfo { get; }
Property Value
CPUInfo
|
CurrentProcessId
Gets the current process unique identifier.
Declaration
[Unmanaged]
public static ulong CurrentProcessId { get; }
Property Value
System.UInt64
|
CurrentThreadID
Gets the current thread unique identifier.
Declaration
[Unmanaged]
public static ulong CurrentThreadID { get; }
Property Value
System.UInt64
|
CustomDpiScale
The custom DPI scale factor to apply globally. Can be used to adjust the User Interface scale (resolution).
Declaration
[Unmanaged]
public static float CustomDpiScale { get; set; }
Property Value
System.Single
|
DesktopSize
Gets size of the primary desktop.
Declaration
[Unmanaged]
public static Float2 DesktopSize { get; }
Property Value
Float2
|
Dpi
Gets the primary monitor's DPI setting.
Declaration
[Unmanaged]
public static int Dpi { get; }
Property Value
System.Int32
|
DpiScale
Gets the primary monitor's DPI setting scale factor (1 is default). Includes custom DPI scale.
Declaration
[Unmanaged]
public static float DpiScale { get; }
Property Value
System.Single
|
ExecutableFilePath
Gets full path of the main engine executable file.
Declaration
[Unmanaged]
public static string ExecutableFilePath { get; }
Property Value
System.String
|
HasFocus
Returns true if app has user focus.
Declaration
[Unmanaged]
public static bool HasFocus { get; }
Property Value
System.Boolean
|
Is64BitApp
Returns true if is running 64 bit application (otherwise 32 bit). It's compile-time constant.
Declaration
[Unmanaged]
public static bool Is64BitApp { get; }
Property Value
System.Boolean
|
Is64BitPlatform
Returns true if running on 64-bit computer
Declaration
[Unmanaged]
public static bool Is64BitPlatform { get; }
Property Value
System.Boolean
|
IsInMainThread
Checks if current execution in on the main thread.
Declaration
public static bool IsInMainThread { get; }
Property Value
System.Boolean
|
MainDirectory
Gets full path of the main engine directory.
Declaration
[Unmanaged]
public static string MainDirectory { get; }
Property Value
System.String
|
MemoryStats
Gets the current memory stats.
Declaration
[Unmanaged]
public static MemoryStats MemoryStats { get; }
Property Value
MemoryStats
|
MousePosition
Gets or sets the mouse cursor position in screen-space coordinates.
Declaration
[Unmanaged]
public static Float2 MousePosition { get; set; }
Property Value
Float2
|
NetworkConnectionType
Gets the current network connection type.
Declaration
[Unmanaged]
public static NetworkConnectionType NetworkConnectionType { get; }
Property Value
NetworkConnectionType
|
PlatformType
Returns the current runtime platform type. It's compile-time constant.
Declaration
[Unmanaged]
public static PlatformType PlatformType { get; }
Property Value
PlatformType
|
ProcessMemoryStats
Gets the process current memory stats.
Declaration
[Unmanaged]
public static ProcessMemoryStats ProcessMemoryStats { get; }
Property Value
ProcessMemoryStats
|
ScreenOrientationType
Gets the current screen orientation type.
Declaration
[Unmanaged]
public static ScreenOrientationType ScreenOrientationType { get; }
Property Value
ScreenOrientationType
|
TimeCycles
Gets the current time as CPU cycles counter.
Declaration
[Unmanaged]
public static ulong TimeCycles { get; }
Property Value
System.UInt64
|
TimeSeconds
Gets the current time in seconds.
Declaration
[Unmanaged]
public static double TimeSeconds { get; }
Property Value
System.Double
|
UniqueDeviceId
Gets the (almost) unique ID of the current user device.
Declaration
[Unmanaged]
public static Guid UniqueDeviceId { get; }
Property Value
System.Guid
|
UserLocaleName
Gets the current locale culture (eg. "pl-PL" or "en-US").
Declaration
[Unmanaged]
public static string UserLocaleName { get; }
Property Value
System.String
|
UserName
Gets the user name.
Declaration
[Unmanaged]
public static string UserName { get; }
Property Value
System.String
|
Users
The list of users.
Declaration
[Unmanaged]
[Collection(MaxCount = 8)]
public static User[] Users { get; }
Property Value
User[]
|
VirtualDesktopBounds
Gets virtual bounds of the desktop made of all the monitors outputs attached.
Declaration
[Unmanaged]
public static Rectangle VirtualDesktopBounds { get; }
Property Value
Rectangle
|
VirtualDesktopSize
Gets virtual size of the desktop made of all the monitors outputs attached.
Declaration
[Unmanaged]
public static Float2 VirtualDesktopSize { get; }
Property Value
Float2
|
WorkingDirectory
Gets the current working directory of the process.
Declaration
[Unmanaged]
public static string WorkingDirectory { get; }
Property Value
System.String
|
Methods
CanOpenUrl(String)
Returns a value indicating whether can open a given URL in a web browser.
Declaration
[Unmanaged]
public static bool CanOpenUrl(string url)
Parameters
System.String
url
The URI to assign to web browser. |
Returns
System.Boolean
True if can open URL, otherwise false. |
CreateProcess(ref CreateProcessSettings)
Creates a new process.
Declaration
[Unmanaged]
public static int CreateProcess(ref CreateProcessSettings settings)
Parameters
CreateProcessSettings
settings
The process settings. |
Returns
System.Int32
Retrieves the termination status of the specified process. Valid only if processed ended. |
CreateWindow(ref CreateWindowSettings)
Creates the window.
Declaration
[Unmanaged]
public static Window CreateWindow(ref CreateWindowSettings settings)
Parameters
CreateWindowSettings
settings
The window settings. |
Returns
Window
The created native window object or null if failed. |
Error(String)
Shows the error message to the user.
Declaration
[Unmanaged]
public static void Error(string msg)
Parameters
System.String
msg
The message content. |
Fatal(String)
Shows the fatal error message to the user.
Declaration
[Unmanaged]
public static void Fatal(string msg)
Parameters
System.String
msg
The message content. |
GetMonitorBounds(Float2)
Gets the origin position and size of the monitor at the given screen-space location.
Declaration
[Unmanaged]
public static Rectangle GetMonitorBounds(Float2 screenPos)
Parameters
Float2
screenPos
The screen position (in pixels). |
Returns
Rectangle
The monitor bounds. |
Info(String)
Shows the information message to the user.
Declaration
[Unmanaged]
public static void Info(string msg)
Parameters
System.String
msg
The message content. |
OpenUrl(String)
Launches a web browser and opens a given URL.
Declaration
[Unmanaged]
public static void OpenUrl(string url)
Parameters
System.String
url
The URI to assign to web browser. |
RunProcess(String, String, Boolean)
Starts a new process (runs commandline). Waits for it's end and captures its output. [Deprecated in v1.6]
Declaration
[Unmanaged]
public static int RunProcess(string cmdLine, string workingDir, bool hiddenWindow = true)
Parameters
System.String
cmdLine
Command line to execute |
System.String
workingDir
The custom path of the working directory. |
System.Boolean
hiddenWindow
True if start process with hidden window. |
Returns
System.Int32
Retrieves the termination status of the specified process. Valid only if processed ended. |
RunProcess(String, String, Dictionary<String, String>, Boolean)
Starts a new process (runs commandline). Waits for it's end and captures its output. [Deprecated in v1.6]
Declaration
[Unmanaged]
public static int RunProcess(string cmdLine, string workingDir, Dictionary<string, string> environment, bool hiddenWindow = true)
Parameters
System.String
cmdLine
Command line to execute |
System.String
workingDir
The custom path of the working directory. |
System.Collections.Generic.Dictionary<System.String, System.String>
environment
The process environment variables. If null the current process environment is used. |
System.Boolean
hiddenWindow
True if start process with hidden window. |
Returns
System.Int32
Retrieves the termination status of the specified process. Valid only if processed ended. |
StartProcess(String, String, String, Boolean, Boolean)
Starts a new process (runs app). [Deprecated in v1.6]
Declaration
[Unmanaged]
public static int StartProcess(string filename, string args, string workingDir, bool hiddenWindow = false, bool waitForEnd = false)
Parameters
System.String
filename
The path to the executable file. |
System.String
args
Custom arguments for command line |
System.String
workingDir
The custom name of the working directory |
System.Boolean
hiddenWindow
True if start process with hidden window |
System.Boolean
waitForEnd
True if wait for process competition |
Returns
System.Int32
Retrieves the termination status of the specified process. Valid only if processed ended. |
Warning(String)
Shows the warning message to the user.
Declaration
[Unmanaged]
public static void Warning(string msg)
Parameters
System.String
msg
The message content. |
Events
UserAdded
Event called when user gets added (eg. logged in).
Declaration
[Unmanaged]
public static event Action<User> UserAdded
Event Type
System.Action<User>
|
UserRemoved
Event called when user gets removed (eg. logged out).
Declaration
[Unmanaged]
public static event Action<User> UserRemoved
Event Type
System.Action<User>
|