You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -40,6 +40,7 @@ using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace System {
|
||||
|
||||
@ -56,7 +57,7 @@ namespace System {
|
||||
* of icalls, do not require an increment.
|
||||
*/
|
||||
#pragma warning disable 169
|
||||
private const int mono_corlib_version = 111;
|
||||
private const int mono_corlib_version = 117;
|
||||
#pragma warning restore 169
|
||||
|
||||
[ComVisible (true)]
|
||||
@ -85,10 +86,7 @@ namespace System {
|
||||
ProgramFiles = 0x26,
|
||||
MyPictures = 0x27,
|
||||
CommonProgramFiles = 0x2b,
|
||||
#if NET_4_0
|
||||
MyVideos = 0x0e,
|
||||
#endif
|
||||
#if NET_4_0
|
||||
NetworkShortcuts = 0x13,
|
||||
Fonts = 0x14,
|
||||
CommonStartMenu = 0x16,
|
||||
@ -112,14 +110,9 @@ namespace System {
|
||||
LocalizedResources = 0x39,
|
||||
CommonOemLinks = 0x3a,
|
||||
CDBurning = 0x3b,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
enum SpecialFolderOption {
|
||||
None = 0,
|
||||
DoNotVerify = 0x4000,
|
||||
@ -170,13 +163,11 @@ namespace System {
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public static int CurrentManagedThreadId {
|
||||
get {
|
||||
return Thread.CurrentThread.ManagedThreadId;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exit code of this process
|
||||
@ -242,7 +233,7 @@ namespace System {
|
||||
public static OperatingSystem OSVersion {
|
||||
get {
|
||||
if (os == null) {
|
||||
Version v = Version.CreateFromString (GetOSVersionString ());
|
||||
Version v = CreateVersionFromString (GetOSVersionString ());
|
||||
PlatformID p = Platform;
|
||||
if (p == PlatformID.MacOSX)
|
||||
p = PlatformID.Unix;
|
||||
@ -252,6 +243,75 @@ namespace System {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// a very gentle way to construct a Version object which takes
|
||||
// the first four numbers in a string as the version
|
||||
internal static Version CreateVersionFromString (string info)
|
||||
{
|
||||
int major = 0;
|
||||
int minor = 0;
|
||||
int build = 0;
|
||||
int revision = 0;
|
||||
int state = 1;
|
||||
int number = -1; // string may not begin with a digit
|
||||
|
||||
if (info == null)
|
||||
return new Version (0, 0, 0, 0);
|
||||
|
||||
for (int i=0; i < info.Length; i++) {
|
||||
char c = info [i];
|
||||
if (Char.IsDigit (c)) {
|
||||
if (number < 0) {
|
||||
number = (c - '0');
|
||||
}
|
||||
else {
|
||||
number = (number * 10) + (c - '0');
|
||||
}
|
||||
}
|
||||
else if (number >= 0) {
|
||||
// assign
|
||||
switch (state) {
|
||||
case 1:
|
||||
major = number;
|
||||
break;
|
||||
case 2:
|
||||
minor = number;
|
||||
break;
|
||||
case 3:
|
||||
build = number;
|
||||
break;
|
||||
case 4:
|
||||
revision = number;
|
||||
break;
|
||||
}
|
||||
number = -1;
|
||||
state ++;
|
||||
}
|
||||
// ignore end of string
|
||||
if (state == 5)
|
||||
break;
|
||||
}
|
||||
|
||||
// Last number
|
||||
if (number >= 0) {
|
||||
switch (state) {
|
||||
case 1:
|
||||
major = number;
|
||||
break;
|
||||
case 2:
|
||||
minor = number;
|
||||
break;
|
||||
case 3:
|
||||
build = number;
|
||||
break;
|
||||
case 4:
|
||||
revision = number;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new Version (major, minor, build, revision);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get StackTrace
|
||||
/// </summary>
|
||||
@ -332,6 +392,11 @@ namespace System {
|
||||
[SecurityPermission (SecurityAction.Demand, UnmanagedCode=true)]
|
||||
public extern static void Exit (int exitCode);
|
||||
|
||||
internal static void _Exit (int exitCode)
|
||||
{
|
||||
Exit (exitCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Substitute environment variables in the argument "name"
|
||||
/// </summary>
|
||||
@ -489,9 +554,7 @@ namespace System {
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static string GetWindowsFolderPath (int folder);
|
||||
|
||||
#if NET_4_0
|
||||
public
|
||||
#endif
|
||||
static string GetFolderPath(SpecialFolder folder, SpecialFolderOption option)
|
||||
{
|
||||
SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
|
||||
@ -608,11 +671,8 @@ namespace System {
|
||||
|
||||
case SpecialFolder.Templates:
|
||||
return ReadXdgUserDir (config, home, "XDG_TEMPLATES_DIR", "Templates");
|
||||
#if NET_4_0
|
||||
case SpecialFolder.MyVideos:
|
||||
return ReadXdgUserDir (config, home, "XDG_VIDEOS_DIR", "Videos");
|
||||
#endif
|
||||
#if NET_4_0
|
||||
case SpecialFolder.CommonTemplates:
|
||||
return "/usr/share/templates";
|
||||
case SpecialFolder.Fonts:
|
||||
@ -620,7 +680,6 @@ namespace System {
|
||||
return Path.Combine (home, "Library", "Fonts");
|
||||
|
||||
return Path.Combine (home, ".fonts");
|
||||
#endif
|
||||
// these simply dont exist on Linux
|
||||
// The spec says if a folder doesnt exist, we
|
||||
// should return ""
|
||||
@ -642,11 +701,9 @@ namespace System {
|
||||
else
|
||||
return String.Empty;
|
||||
|
||||
#if NET_4_0
|
||||
// #2873
|
||||
case SpecialFolder.UserProfile:
|
||||
return home;
|
||||
#endif
|
||||
|
||||
case SpecialFolder.Programs:
|
||||
case SpecialFolder.SendTo:
|
||||
@ -657,7 +714,6 @@ namespace System {
|
||||
case SpecialFolder.Recent:
|
||||
case SpecialFolder.CommonProgramFiles:
|
||||
case SpecialFolder.System:
|
||||
#if NET_4_0
|
||||
case SpecialFolder.NetworkShortcuts:
|
||||
case SpecialFolder.CommonStartMenu:
|
||||
case SpecialFolder.CommonPrograms:
|
||||
@ -678,7 +734,6 @@ namespace System {
|
||||
case SpecialFolder.LocalizedResources:
|
||||
case SpecialFolder.CommonOemLinks:
|
||||
case SpecialFolder.CDBurning:
|
||||
#endif
|
||||
return String.Empty;
|
||||
// This is where data common to all users goes
|
||||
case SpecialFolder.CommonApplicationData:
|
||||
@ -831,15 +886,17 @@ namespace System {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
internal static void FailFast (String message, uint exitCode)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
public static void FailFast (string message, Exception exception)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
public static bool Is64BitOperatingSystem {
|
||||
get { return IntPtr.Size == 8; } // FIXME: is this good enough?
|
||||
}
|
||||
@ -847,13 +904,8 @@ namespace System {
|
||||
public static int SystemPageSize {
|
||||
get { return GetPageSize (); }
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static bool Is64BitProcess {
|
||||
get { return IntPtr.Size == 8; }
|
||||
}
|
||||
@ -920,6 +972,17 @@ namespace System {
|
||||
return Environment.Platform == PlatformID.MacOSX;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsCLRHosted {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void TriggerCodeContractFailure(ContractFailureKind failureKind, String message, String condition, String exceptionAsString)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user