mirror of
https://github.com/aaru-dps/Aaru.CommonTypes.git
synced 2025-12-16 19:24:30 +00:00
Add XML comments to public entities.
This commit is contained in:
@@ -44,14 +44,29 @@ using System.Security.Principal;
|
||||
|
||||
namespace Aaru.CommonTypes.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Detects the underlying execution framework and operating system
|
||||
/// </summary>
|
||||
public static class DetectOS
|
||||
{
|
||||
/// <summary>
|
||||
/// Are we running under Mono?
|
||||
/// </summary>
|
||||
public static readonly bool IsMono =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith("Mono", StringComparison.Ordinal);
|
||||
/// <summary>
|
||||
/// Are we running under .NET Framework?
|
||||
/// </summary>
|
||||
public static readonly bool IsNetFramework =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal);
|
||||
/// <summary>
|
||||
/// Are we running under .NET Core?
|
||||
/// </summary>
|
||||
public static readonly bool IsNetCore =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal);
|
||||
/// <summary>
|
||||
/// Are we running under .NET Native?
|
||||
/// </summary>
|
||||
public static readonly bool IsNetNative =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.Ordinal);
|
||||
|
||||
@@ -61,6 +76,9 @@ namespace Aaru.CommonTypes.Interop
|
||||
/// <summary>Checks if the underlying runtime runs in 32-bit mode</summary>
|
||||
public static readonly bool Is32Bit = IntPtr.Size == 4;
|
||||
|
||||
/// <summary>
|
||||
/// Are we running under Windows?
|
||||
/// </summary>
|
||||
public static bool IsWindows => GetRealPlatformID() == PlatformID.Win32NT ||
|
||||
GetRealPlatformID() == PlatformID.Win32S ||
|
||||
GetRealPlatformID() == PlatformID.Win32Windows ||
|
||||
@@ -68,6 +86,9 @@ namespace Aaru.CommonTypes.Interop
|
||||
GetRealPlatformID() == PlatformID.WindowsPhone ||
|
||||
GetRealPlatformID() == PlatformID.Xbox;
|
||||
|
||||
/// <summary>
|
||||
/// Are we running with administrative (root) privileges?
|
||||
/// </summary>
|
||||
public static bool IsAdmin
|
||||
{
|
||||
get
|
||||
|
||||
@@ -115,6 +115,8 @@ namespace Aaru.CommonTypes.Interop
|
||||
/// <summary>SCO UnixWare</summary>
|
||||
UnixWare = 34,
|
||||
/// <summary>IBM z/OS</summary>
|
||||
zOS = 35, Unknown = -1
|
||||
zOS = 35,
|
||||
/// <summary>Unknown</summary>
|
||||
Unknown = -1
|
||||
}
|
||||
}
|
||||
@@ -42,12 +42,19 @@ using System.Runtime;
|
||||
|
||||
namespace Aaru.CommonTypes.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets our own, or the runtime's version
|
||||
/// </summary>
|
||||
public static class Version
|
||||
{
|
||||
/// <summary>Gets version string</summary>
|
||||
/// <returns>Version</returns>
|
||||
public static string GetVersion() => typeof(Version).Assembly.GetName().Version?.ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Gets .NET Core version
|
||||
/// </summary>
|
||||
/// <returns>Version</returns>
|
||||
public static string GetNetCoreVersion()
|
||||
{
|
||||
Assembly assembly = typeof(GCSettings).Assembly;
|
||||
@@ -69,6 +76,10 @@ namespace Aaru.CommonTypes.Interop
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Mono version
|
||||
/// </summary>
|
||||
/// <returns>Version</returns>
|
||||
public static string GetMonoVersion()
|
||||
{
|
||||
if(!DetectOS.IsMono)
|
||||
|
||||
Reference in New Issue
Block a user