Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@ -0,0 +1,44 @@
using System.Collections;
using System.Globalization;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
using Mono;
namespace System
{
partial class Environment
{
static string GetEnvironmentVariableCore (string variable)
{
using (var h = RuntimeMarshal.MarshalString (variable)) {
return internalGetEnvironmentVariable_native (h.Value);
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern static string internalGetEnvironmentVariable_native (IntPtr variable);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static string [] GetEnvironmentVariableNames ();
public static IDictionary GetEnvironmentVariables ()
{
Hashtable vars = new Hashtable ();
foreach (string name in GetEnvironmentVariableNames ()) {
vars [name] = GetEnvironmentVariableCore (name);
}
return vars;
}
static unsafe void SetEnvironmentVariableCore (string variable, string value)
{
fixed (char *fixed_variable = variable)
fixed (char *fixed_value = value)
InternalSetEnvironmentVariable (fixed_variable, variable.Length, fixed_value, value?.Length ?? 0);
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
static extern unsafe void InternalSetEnvironmentVariable (char *variable, int variable_length, char *value, int value_length);
}
}