Files
2026-06-04 11:42:34 +02:00

74 lines
2.9 KiB
C#

using System;
using System.IO;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
namespace System.Runtime.InteropServices
{
/// <summary>Provides a collection of static methods that return information about the common language runtime environment.</summary>
// Token: 0x02000339 RID: 825
[ComVisible(true)]
public class RuntimeEnvironment
{
/// <summary>Gets the path to the system configuration file.</summary>
/// <returns>The path to the system configuration file.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000658 RID: 1624
// (get) Token: 0x06002305 RID: 8965 RVA: 0x0007A660 File Offset: 0x00078860
public static string SystemConfigurationFile
{
get
{
string machineConfigPath = Environment.GetMachineConfigPath();
if (SecurityManager.SecurityEnabled)
{
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, machineConfigPath).Demand();
}
return machineConfigPath;
}
}
/// <summary>Tests whether the specified assembly is loaded in the global assembly cache (GAC).</summary>
/// <returns>true if the assembly is loaded in the GAC; otherwise, false.</returns>
/// <param name="a">The assembly to determine if it is loaded in the GAC. </param>
// Token: 0x06002306 RID: 8966 RVA: 0x0007A68C File Offset: 0x0007888C
public static bool FromGlobalAccessCache(Assembly a)
{
return a.GlobalAssemblyCache;
}
/// <summary>Gets the directory where the common language runtime is installed.</summary>
/// <returns>A string containing the path to the directory where the common language runtime is installed.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06002307 RID: 8967 RVA: 0x0007A694 File Offset: 0x00078894
public static string GetRuntimeDirectory()
{
return Path.GetDirectoryName(typeof(int).Assembly.Location);
}
/// <summary>Gets the version number of the common language runtime that is running the current process.</summary>
/// <returns>A string containing the version number of the common language runtime.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x06002308 RID: 8968 RVA: 0x0007A6B0 File Offset: 0x000788B0
public static string GetSystemVersion()
{
return string.Concat(new object[]
{
"v",
Environment.Version.Major,
".",
Environment.Version.Minor,
".",
Environment.Version.Build
});
}
}
}