|
DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
|
Provides environment variables, machine info, hardware traits, and platform properties. More...
#include <Environment.h>
Public Types | |
| enum class | SpecialFolder { ApplicationData , CommonApplicationData , CommonProgramFiles , Cookies , Desktop , Favorites , History , InternetCache , LocalApplicationData , MyComputer , MyDocuments , MyMusic , MyPictures , MyVideos , ProgramFiles , Programs , Recent , SendTo , StartMenu , Startup , System , Templates , UserProfile } |
| Specifies enumerated constants used to retrieve directory paths to system special folders. More... | |
Static Public Member Functions | |
| static void | Exit (int iExitCode) |
| Terminates this process and returns an exit code to the operating system. | |
| static String | ExpandEnvironmentVariables (const String &sName) |
| Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable. | |
| static Array< String > | GetCommandLineArgs () |
| Returns a string array containing the command-line arguments for the current process. | |
| static String | GetCurrentDirectory () |
| Gets the fully qualified path of the current working directory. | |
| static String | GetEnvironmentVariable (const String &sVariable) |
| Retrieves the value of an environment variable from the current process. | |
| static Collections::Generic::Dictionary< String, String > | GetEnvironmentVariables () |
| Retrieves all environment variable names and their values from the current process. | |
| static String | GetFolderPath (SpecialFolder eFolder) |
| Gets the path to the system special folder that is identified by the specified enumeration. | |
| static Array< String > | GetLogicalDrives () |
| Returns an array of string containing the names of the logical drives on the current computer. | |
| static String | GetMachineName () |
| Gets the NetBIOS / network name of this local computer. | |
| static String | GetNewLine () |
| Gets the newline string defined for this environment ("\r\n" on Windows, "\n" on POSIX). | |
| static OperatingSystem | GetOperatingSystem () |
| Gets an OperatingSystem object that contains the current platform identifier and version. | |
| static String | GetOSVersion () |
| Gets an operating system version string representation. | |
| static int | GetProcessorCount () |
| Gets the number of logical processors available on the current machine. | |
| static String | GetSystemDirectory () |
| Gets the fully qualified path of the system directory. | |
| static String | GetUserDomainName () |
| Gets the network domain name associated with the current user. | |
| static String | GetUserName () |
| Gets the user name of the person who is currently logged on to the OS. | |
| static int64_t | GetWorkingSet () |
| Gets the amount of physical memory mapped to the process context (Working Set in bytes). | |
| static void | SetEnvironmentVariable (const String &sVariable, const String &sValue) |
| Creates, modifies, or deletes an environment variable stored in the current process. | |
| Static Public Member Functions inherited from DotNetDupe::System::Object | |
| static bool | Equals (const Object &obj1, const Object &obj2) |
| Static helper determining whether two object instances are equal. | |
Additional Inherited Members | |
| Public Member Functions inherited from DotNetDupe::System::Object | |
| virtual | ~Object ()=default |
| Virtual destructor ensuring polymorphic cleanup. | |
| virtual bool | Equals (const Object &obj) const |
| Determines whether the specified Object is equal to the current Object. | |
| virtual int | GetHashCode () const |
| Serves as the default hash function. | |
| bool | operator== (const Object &obj) const |
| Determines reference equality between two objects. | |
| char * | ToStringA () const |
| Returns narrow-character string representation. | |
| wchar_t * | ToStringW () const |
| Returns wide-character string representation. | |
Provides environment variables, machine info, hardware traits, and platform properties.
Mirrors .NET System.Environment with cross-platform implementations for Windows and Linux. Static methods provide access to execution context, memory working set, and command-line arguments. Thread-safe for const queries; environment mutations affect the entire process.
Definition at line 34 of file Environment.h.
|
strong |
Specifies enumerated constants used to retrieve directory paths to system special folders.
Definition at line 37 of file Environment.h.
|
static |
Terminates this process and returns an exit code to the operating system.
| iExitCode | Exit code to return. |
Definition at line 160 of file Environment.cpp.
Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable.
| sName | A string containing the names of zero or more environment variables. |
Expand embedded environment variable tokens in target string.
Definition at line 164 of file Environment.cpp.
References DotNetDupe::System::String::String(), DotNetDupe::System::String::EndsWith(), DotNetDupe::System::String::GetLength(), DotNetDupe::System::String::GetRawString(), DotNetDupe::System::String::StartsWith(), DotNetDupe::System::String::Substring(), DotNetDupe::System::Internal::Utf8ToWChar(), and DotNetDupe::System::Internal::WCharToUtf8().
Returns a string array containing the command-line arguments for the current process.
Definition at line 199 of file Environment.cpp.
References DotNetDupe::System::ReadCommandLineTokens().
|
static |
Gets the fully qualified path of the current working directory.
Step: Query active working directory path.
Definition at line 83 of file Environment.cpp.
References DotNetDupe::System::String::String(), and DotNetDupe::System::Internal::WCharToUtf8().
Retrieves the value of an environment variable from the current process.
| sVariable | Variable name. |
Definition at line 206 of file Environment.cpp.
References DotNetDupe::System::String::String(), DotNetDupe::System::String::GetRawString(), DotNetDupe::System::Internal::Utf8ToWChar(), and DotNetDupe::System::Internal::WCharToUtf8().
|
static |
Retrieves all environment variable names and their values from the current process.
Definition at line 227 of file Environment.cpp.
References DotNetDupe::System::String::String(), DotNetDupe::System::ParseAndAddEnvEntry(), and DotNetDupe::System::Internal::WCharToUtf8().
|
static |
Gets the path to the system special folder that is identified by the specified enumeration.
Definition at line 275 of file Environment.cpp.
References DotNetDupe::System::String::String(), DotNetDupe::System::GetCsidlForFolder(), LocalApplicationData, MyDocuments, UserProfile, and DotNetDupe::System::Internal::WCharToUtf8().
Returns an array of string containing the names of the logical drives on the current computer.
Definition at line 289 of file Environment.cpp.
References DotNetDupe::System::String::String(), and GetLogicalDrives().
Referenced by GetLogicalDrives().
|
static |
Gets the NetBIOS / network name of this local computer.
Step: Query host machine computer name from platform API.
Definition at line 30 of file Environment.cpp.
References DotNetDupe::System::String::String(), and DotNetDupe::System::Internal::WCharToUtf8().
Referenced by GetUserDomainName().
|
static |
Gets the newline string defined for this environment ("\r\n" on Windows, "\n" on POSIX).
Return: Platform standard newline string (\r
on Windows,
on POSIX).
Definition at line 74 of file Environment.cpp.
|
static |
Gets an OperatingSystem object that contains the current platform identifier and version.
Definition at line 317 of file Environment.cpp.
References DotNetDupe::System::OperatingSystem::OperatingSystem(), DotNetDupe::System::Version::Version(), DotNetDupe::System::Unix, and DotNetDupe::System::Win32NT.
|
static |
Gets an operating system version string representation.
Step: Query operating system version descriptor string.
Definition at line 109 of file Environment.cpp.
References DotNetDupe::System::String::String().
|
static |
Gets the number of logical processors available on the current machine.
Step: Query available logical processor core count from system information.
Definition at line 63 of file Environment.cpp.
|
static |
Gets the fully qualified path of the system directory.
Step: Query system directory location.
Definition at line 98 of file Environment.cpp.
References DotNetDupe::System::String::String(), and DotNetDupe::System::Internal::WCharToUtf8().
|
static |
Gets the network domain name associated with the current user.
Forward: Delegate to GetMachineName.
Definition at line 129 of file Environment.cpp.
References GetMachineName().
|
static |
Gets the user name of the person who is currently logged on to the OS.
Step: Query current authenticated user login name from operating system.
Definition at line 46 of file Environment.cpp.
References DotNetDupe::System::String::String().
|
static |
Gets the amount of physical memory mapped to the process context (Working Set in bytes).
Query resident physical memory working set from operating system.
Definition at line 149 of file Environment.cpp.
|
static |
Creates, modifies, or deletes an environment variable stored in the current process.
Definition at line 307 of file Environment.cpp.
References DotNetDupe::System::String::GetRawString(), and DotNetDupe::System::Internal::Utf8ToWChar().