Operating System Simulator Plugin
3.5.1
Unreal Engine plugin that simulates an Operating System Environment
|
#include "OperatingSystemStatics.h"
Static Public Member Functions | |
static bool | IsUniqueIdValid (const FOperatingSystemUniqueId &TestID) |
static FString | UniqueIdToString (const FOperatingSystemUniqueId &TestID) |
static bool | IsOperatingSystemTagValid (const FGameplayTag &TestTag) |
static int32 | GetSize (const EOperatingSystemCommonSizes &Size) |
static FGenericError | CreateGenericError (const FText ErrorCode, const FText ErrorDescription) |
static FOperatingSystemNotification | CreateNotification (const FText Title, const FText Description, const EOperatingSystemNotificationCategory NotificationCategory, const EOperatingSystemNotificationType Verbosity, const TSoftObjectPtr< UObject > Icon, const FText Code) |
static double | ConvertMB_ToBytes (const float SizeInMB) |
static double | ConvertGB_ToBytes (const float SizeInGB) |
static float | ConvertGB_ToMB (const float SizeInGB) |
static float | ConvertMB_ToGB (const float SizeInMB) |
static float | ConvertBytes_ToGB (const double SizeInBytes) |
static float | ConvertBytes_ToMB (const double SizeInBytes) |
static UOperatingSystemBaseHardware * | FindHardwareByTag (const AOperatingSystemDeviceActor *TargetDevice, const FGameplayTag HardwareTag) |
static bool | GetCpuSocketName (const FGameplayTag SocketTag, FText &OutValue) |
static void | ShutdownOperatingSystem (UOperatingSystem *TargetOS, FGenericError &OutError) |
static void | RestartOperatingSystem (UOperatingSystem *TargetOS, FGenericError &OutError) |
static bool | AddNotification (UOperatingSystem *TargetOperatingSystem, const FOperatingSystemNotification &Notification) |
static bool | AddNotificationFromError (UOperatingSystem *TargetOperatingSystem, const FGenericError &Error, const EOperatingSystemNotificationCategory NotificationCategory, const EOperatingSystemNotificationType Verbosity=EOperatingSystemNotificationType::Error) |
static UOperatingSystemFile * | OpenFile (UOperatingSystemFile *TargetFile, FGenericError &OutError) |
static bool | IsUserValid (const FOperatingSystemUser &TestUser) |
static bool | IsRegisteredUserValid (const FOperatingSystemUser &TestUser) |
static bool | UserHasCompleteProfile (const FOperatingSystemUser &TestUser) |
static bool | UsersEqual (const FOperatingSystemUser &Lhs, const FOperatingSystemUser &Rhs) |
static bool | UsersNotEqual (const FOperatingSystemUser &Lhs, const FOperatingSystemUser &Rhs) |
static bool | IsNotificationValid (const FOperatingSystemNotification &TestNotification) |
static bool | GetSpecialDirectoryName (const FGameplayTag DirectoryTag, FText &OutDirectoryName) |
static FText | GetCpuSpeedAsText (const float &CpuSpeedInGHz, const bool bUseGHZ=true) |
static FText | GetSizeAsText (const EOperatingSystemCommonSizes Size) |
static FText | GenerateRandomErrorCode () |
static FText | GetTimeAsText (const FDateTime &DateTime, const bool bShowSeconds=false, const EOperatingSystemTimeSeparator Separator=EOperatingSystemTimeSeparator::Colon) |
static FText | GetDateAsText (const FDateTime &DateTime, const EOperatingSystemDateSeparator Separator=EOperatingSystemDateSeparator::Dash) |
static FText | GetRelativeTime (const FDateTime &UtcTime, const bool bShowMinutesDifference=true, const bool bShowHourDifference=true, const bool bShowDaysDifference=true, const EOperatingSystemDateSeparator DateSeparator=EOperatingSystemDateSeparator::Dash, const EOperatingSystemTimeSeparator TimeSeparator=EOperatingSystemTimeSeparator::Colon) |
static FString | RegexExpression (const FString &TargetString, const FString RegexPattern) |
static EOperatingSystemPasswordStrength | DeterminePasswordStrength (const FString &Input) |
static AOperatingSystemDeviceActor * | FindDeviceActorByTag (const UObject *WorldContextObject, const FGameplayTag TestTag) |
static void | FindDeviceActorsByTag (const UObject *WorldContextObject, const FGameplayTag TestTag, TArray< AOperatingSystemDeviceActor * > &OutDeviceActors) |
static UOperatingSystemDeviceMessenger * | FindMessengerForDevice (const UObject *WorldContextObject, const FGameplayTag TestTag) |
static UOperatingSystemDeviceMessenger * | FindMessengerFromOperatingSystem (const UOperatingSystem *TargetOS) |
static UOperatingSystemUserManager * | GetUserManager (const UObject *WorldContextObject) |
static bool | IsProgramClassCompatibleWithOS (const TSubclassOf< UOperatingSystemBaseProgram > ProgramClass, const UOperatingSystem *TargetOS, FGenericError &OutError) |
static FTimespan | GetTimeDifferenceFromUTC () |
static FDateTime | ConvertUtcTimeToLocalTime (const FDateTime &UtcTime) |
static float | GetRangeTime (const FOperatingSystemRangeTime &TimeRange, const float FallbackTime=0.2) |
static void | RequestFundsFromBank (const UObject *WorldContextObject, FGenericError &OutErrorIfAny, const FOperatingSystemUser &TargetUser, const FOperatingSystemRequestFund FundDetails) |
static float | CalculatePercentageForValue (const float Percentage, const float TargetValue) |
static bool | EvaluateMathExpression (const FString Expression, float &OutValue) |
static bool | IsMailDataValid (const FOperatingSystemMailSetting &TestMailSetting) |
static bool | DrawWidgetToTexture (const UObject *WorldContextObject, UTextureRenderTarget2D *TargetTexture, UUserWidget *Widget, const bool bDeferUpdate=true, const float DeltaTime=0.f) |
static FText | GetMonthName (const FDateTime &DateTime, const bool bShort=false) |
static UTexture2D * | CreateTextureFromPath (const FString &InImagePath) |
static FOperatingSystemBattery | CreateNewBattery (const FText Name, const FText Brand, const float Capacity, const float ChargeRate, const EOperatingSystemBatteryEfficiencyLoss EfficiencyLoss, FGenericError &OutError) |
static float | GetBatteryHealth (const FOperatingSystemBattery &Battery, const bool bNormalize=true) |
static FText | GetBatteryHealthText (const FOperatingSystemBattery &Battery) |
static FString | GetPathDelimiter (const UOperatingSystem *TargetOS) |
Static Protected Member Functions | |
static FString | VersionToString (const FOperatingSystemVersion &Version, const bool bIgnorePatch=false) |
static bool | Equal_Version (const FOperatingSystemVersion &VersionOne, const FOperatingSystemVersion &VersionTwo) |
static bool | LessThan_Version (const FOperatingSystemVersion &VersionOne, const FOperatingSystemVersion &VersionTwo) |
static bool | GreaterThan_Version (const FOperatingSystemVersion &VersionOne, const FOperatingSystemVersion &VersionTwo) |
A static library of functions related to the operating system.
This class provides various static functions for operating system related operations.
|
static |
Adds a notification to the specified operating system.
TargetOperatingSystem | The operating system to add the notification to. |
Notification | The notification to add. |
|
static |
Adds a notification from an error to the operating system.
TargetOperatingSystem | The target operating system to add the notification to. |
Error | The error to generate the notification from. |
NotificationCategory | The category of the notification. |
Verbosity | The verbosity level of the notification. Defaults to EOperatingSystemNotificationType::Error. |
|
static |
Calculates the percentage of a given TargetValue
based on the Percentage
provided. If the Percentage
is less than or equal to 0, the method returns 0.
Percentage | The percentage value to calculate. |
TargetValue | The target value to calculate the percentage on. |
|
static |
Converts the given size in bytes to gigabytes.
SizeInBytes | The size in bytes to convert. |
|
static |
Converts a size in bytes to megabytes.
This method assumes size in bytes as input and returns the equivalent size in megabytes.
SizeInBytes | The size in bytes to be converted. |
|
static |
Converts size from gigabytes (GB) to bytes.
This method takes a size in gigabytes and converts it to bytes.
SizeInGB | The size in gigabytes to convert. |
|
static |
Converts the given size in gigabytes to megabytes.
SizeInGB | The size in gigabytes to be converted. |
|
static |
Converts a size in Megabytes (MB) to bytes.
SizeInMB | The size in Megabytes to convert. |
|
static |
Converts the given size in megabytes to gigabytes.
SizeInMB | The size in megabytes to be converted. |
|
static |
Takes a UTC time and converts it to the local time zone.
UtcTime | The UTC time to convert. |
|
static |
Creates a generic error object using the provided error code and error description. The error code and error description should be passed as parameters to this method.
ErrorCode | The error code for the generic error object. |
ErrorDescription | The error description for the generic error object. |
|
static |
Creates a new battery from given parameters.
Name | Battery name. |
Brand | Battery brand name. |
Capacity | Battery capacity. Recommended value between 1000 - 5000. |
ChargeRate | Higher numbers charge battery faster and lower number charge slower. Expects a number greater than 1000. |
EfficiencyLoss | Determines health. Higher efficiency loss means poorer battery health. |
OutError | Outputs error (if any). |
|
static |
Creates a new operating system notification.
Title | The title of the notification. |
Description | The description of the notification. |
NotificationCategory | The category of the notification. |
Verbosity | The verbosity level of the notification. |
Icon | The icon associated with the notification. |
Code | The code associated with the notification. |
|
static |
Returns a UTexture2D from the given path. Image path should be accessible and absolute (for example: C:\SomeDirectory\MyImage.png)
InImagePath | Absolute path to an image texture. (For example: C:\SomeDirectory\MyImage.png |
|
static |
Determines the strength of a password based on the given input string.
Input | The input string representing the password. |
EOperatingSystemPasswordStrength
enum value.
|
static |
Projects the given widget to a texture target.
WorldContextObject | World context object to retrieve subsystem. |
TargetTexture | Render target to draw the widget. |
Widget | Widget to project texture. |
bDeferUpdate | Whether or not the update is deferred until the end of the frame when it is potentially less expensive to update the render target. |
DeltaTime | Currently unused by Unreal Engine itself. |
|
staticprotected |
Compares two FVersion structs and returns true if they are equal, false otherwise.
VersionOne | The first FVersion struct to compare. |
VersionTwo | The second FVersion struct to compare. |
|
static |
Evaluates the numerical equation. Operators and precedence: 1:+- 2:/% 3:* 4:^ 5:&| Unary: - Types: Numbers (0-9.), Hex ($0-$f) Grouping: ( )
Expression | Equation to evaluate. |
OutValue | Result of the equation if return value is true. |
|
static |
Finds a device actor by tag.
WorldContextObject | The world context object. |
TestTag | The tag used for finding the device actor. |
|
static |
Finds device actors with a specific gameplay tag.
This method allows you to find device actors in the world that have a specific gameplay tag. The device actors are returned through an output parameter.
WorldContextObject | The world context object. |
TestTag | The gameplay tag used to filter the device actors. |
OutDeviceActors | An array of device actors that are found with the specified tag. |
|
static |
Finds a hardware object with a specific tag on a given device.
TargetDevice | The device on which to search for the hardware. |
HardwareTag | The tag that the hardware should have. |
|
static |
Finds the messenger for a given device by its test tag.
WorldContextObject | The world context object. |
TestTag | The test tag of the device. |
|
static |
Finds a messenger for the given operating system.
This method searches for a messenger associated with the given operating system. If the operating system is valid and is associated with a parent device, the messenger of that parent device is returned.
TargetOS | The operating system to find the messenger for. |
|
static |
Generates a random error code.
|
inlinestatic |
Returns the battery health of the given battery.
This method returns the battery health value as a float. The battery health value represents the percentage of energy loss while charging the battery. By default, the efficiency loss value is calculated using the formula ((static_cast<uint8>(EfficiencyLoss) + 1) * 100.f) / 10.f. If bNormalize is true, the efficiency loss value is normalized to a range of [0, 1] using the formula (static_cast<uint8>(EfficiencyLoss) + 1) / 10.f.
Battery | The FOperatingSystemBattery struct representing the battery. |
bNormalize | (optional) Specifies whether to normalize the battery health. Defaults to true. |
|
inlinestatic |
Returns the text description of the battery health state.
|
static |
Retrieves the name of a CPU socket based on a given socket tag.
SocketTag | The socket tag used to identify the CPU socket. |
OutValue | The output parameter that will store the retrieved CPU socket name. |
This method retrieves the name of a CPU socket based on a given socket tag. The socket tag must be a valid operating system tag and must start with "OperatingSystem.Hardware.CPU.". If the socket tag is valid and starts with the correct prefix, the method removes the prefix, replaces any "." characters with spaces, and sets the OutValue parameter with the resulting CPU socket name. The method then returns true.
If the socket tag is not a valid operating system tag or does not start with the correct prefix, the method returns false and does not modify the OutValue parameter.
|
static |
public static UOperatingSystemStatics::GetCpuSpeedAsText Returns the CPU speed as FText.
CpuSpeedInGHz | [const float&] CPU Speed in GHz. |
bUseGHZ | [const bool] If true return value will use GHz. If false, it will be MHz. |
|
static |
Returns the given date in text format.
DateTime | The date and time to convert. |
Separator | The separator to use for the date components. Defaults to a dash (-). |
|
static |
Returns the month name from the given date time struct. If Short is selected, return name will be "Jan", "Feb" instead of "January", "February".
DateTime | Date Time to get month name from. |
bShort | Returns short name such as "Jan", "Feb" instead of "January", "February". |
|
static |
Returns the path delimiter used by the given operating system.
This method returns the path delimiter based on the given operating system. If the operating system is Unix-based, the delimiter will be '/'. Otherwise, if the operating system is Windows-based, the delimiter will be '\'.
TargetOS | The target operating system instance. |
|
static |
Retrieves a random time from a given range represented by the structure FOperatingSystemRangeTime. If the range is empty or invalid, it will return the fallback time.
TimeRange | The range of time to get the time from. |
FallbackTime | The fallback time to return if the given range is empty or invalid. |
|
static |
Returns the relative time difference between the given UtcTime and the current local time.
UtcTime | The UTC time to compare against the current local time. |
bShowMinutesDifference | If set to true, displays the time difference in minutes. |
bShowHourDifference | If set to true, displays the time difference in hours. |
bShowDaysDifference | If set to true, displays the time difference in days. |
DateSeparator | The separator to use for displaying the date. |
TimeSeparator | The separator to use for displaying the time. |
|
static |
Get the size corresponding to the given operating system common size.
This method takes an enumeration value representing a common size for an operating system. It returns the actual size in bytes corresponding to the given common size. If the input size is EOperatingSystemCommonSizes::None, the method returns 0.
Size | The operating system common size enumeration value. |
|
static |
Get the size as text for a given operating system size.
This method uses the operating system size to calculate the size as text.
Size | The operating system size. |
|
static |
Retrieves the special directory name based on the given directory tag.
DirectoryTag | The gameplay tag representing the directory. |
OutDirectoryName | The output text containing the directory name. |
|
static |
Returns the given DateTime as a text representation.
DateTime | The DateTime value to convert. |
bShowSeconds | Whether to include the seconds value. |
Separator | The separator character to use between the hour and minute values. |
|
static |
Returns the time difference between UTC and computer local time.
|
static |
Retrieve the user manager instance for the operating system.
Returns a pointer to the UOperatingSystemUserManager object, which is responsible for managing users in the operating system.
WorldContextObject | The world context object needed for retrieving the user manager instance. |
|
staticprotected |
Determines whether VersionOne is greater than VersionTwo.
VersionOne | The first version. |
VersionTwo | The second version. |
|
static |
Checks if the provided mail data is valid.
TestMailSetting | The mail setting to be validated. |
|
static |
Checks if a notification is valid.
This function checks if a given notification object is valid.
TestNotification | The notification object to check. |
|
static |
Checks if the given operating system tag is valid by verifying if it is not null and not equal to the invalid tag.
TestTag | The operating system tag to check. |
|
static |
Check if a program class is compatible with the operating system.
ProgramClass | The class of the program to check compatibility for. |
TargetOS | The target operating system to check compatibility with. |
OutError | [out] Any error encountered during the compatibility check. |
|
static |
Check if the user is registered (in the sense that user has email and password set)
TestUser | The registered user to check for validity. |
|
static |
Checks whether a given unique id is valid or not.
TestID | The unique id to be checked. |
|
static |
Checks if a user is valid.
TestUser | The user to be tested. |
|
staticprotected |
Checks if VersionOne is less than VersionTwo.
VersionOne | The first version to compare. |
VersionTwo | The second version to compare. |
|
static |
Opens the given file and returns the file object.
TargetFile | The file to be opened. |
OutError | Reference to a FGenericError object which will be filled with any errors that occur during the file opening process. |
|
static |
Performs regex expression matching on a target string. This method searches the target string for the first occurrence of the regex pattern and returns the matched substring.
TargetString | The string to search within. |
RegexPattern | The regex pattern to match against the target string. |
|
static |
Request funds from imaginary bank.
WorldContextObject | World Context Object. |
OutErrorIfAny | Outputs any error message if there are any. |
TargetUser | User that is requesting for funds. |
FundDetails | Details of fund to request. |
|
static |
Restarts the operating system of a target device.
This method is used to restart the operating system of the specified target device. It calls the DeviceSessionEnd method on the parent device of the target OS, passing true as the argument.
TargetOS | The UOperatingSystem instance representing the target operating system. |
OutError | Any error that outputs. |
|
static |
Shuts down an operating system.
This function is responsible for shutting down the specified operating system. It terminates the device session associated with the operating system, indicating whether the session should end gracefully or not.
TargetOS | The operating system to shut down. |
OutError | Any error that outputs. |
|
static |
Converts a unique ID to its string representation.
TestID | The unique ID to convert. |
|
static |
Checks if the user has a complete profile.
TestUser | The user to check. |
|
static |
Compares two FOperatingSystemUser objects for equality.
This method compares two FOperatingSystemUser objects, Lhs and Rhs, and returns true if they are equal, false otherwise. Equality is determined by comparing the individual properties of the FOperatingSystemUser objects.
Lhs | The first FOperatingSystemUser object to compare. |
Rhs | The second FOperatingSystemUser object to compare. |
|
static |
Checks if two FOperatingSystemUser objects are not equal.
This method compares two FOperatingSystemUser objects and returns true if they are not equal, and false otherwise.
Lhs | The first FOperatingSystemUser object to compare. |
Rhs | The second FOperatingSystemUser object to compare. |
|
staticprotected |
Converts a version number to a string representation.
Version | [const FVersion&] The version number to convert. |
bIgnorePatch | [const bool] If true, the patch number will be ignored. |