New tests.
[mono.git] / mcs / class / corlib / System / Environment.cs
index 358ac4184888dec2ab2bb492473121029fc04170..91e02d48e58781e6b323b30f1a0728e30f38fe79 100644 (file)
@@ -54,7 +54,9 @@ namespace System {
                 * Changes which are already detected at runtime, like the addition
                 * of icalls, do not require an increment.
                 */
-               private const int mono_corlib_version = 88;
+#pragma warning disable 169
+               private const int mono_corlib_version = 90;
+#pragma warning restore 169
 
                [ComVisible (true)]
                public enum SpecialFolder
@@ -82,6 +84,43 @@ namespace System {
                        ProgramFiles = 0x26,
                        MyPictures = 0x27,
                        CommonProgramFiles = 0x2b,
+#if NET_4_0 || MOONLIGHT
+                       MyVideos = 0x0e,
+#endif
+#if NET_4_0
+                       NetworkShortcuts = 0x13,
+                       Fonts = 0x14,
+                       CommonStartMenu = 0x16,
+                       CommonPrograms = 0x17,
+                       CommonStartup = 0x18,
+                       CommonDesktopDirectory = 0x19,
+                       PrinterShortcuts = 0x1b,
+                       Windows = 0x24,
+                       UserProfile = 0x28,
+                       SystemX86 = 0x29,
+                       ProgramFilesX86 = 0x2a,
+                       CommonProgramFilesX86 = 0x2c,
+                       CommonTemplates = 0x2d,
+                       CommonDocuments = 0x2e,
+                       CommonAdminTools = 0x2f,
+                       AdminTools = 0x30,
+                       CommonMusic = 0x35,
+                       CommonPictures = 0x36,
+                       CommonVideos = 0x37,
+                       Resources = 0x38,
+                       LocalizedResources = 0x39,
+                       CommonOemLinks = 0x3a,
+                       CDBurning = 0x3b,
+#endif
+               }
+
+#if NET_4_0
+               public
+#endif
+               enum SpecialFolderOption {
+                       None = 0,
+                       DoNotVerify = 0x4000,
+                       Create = 0x8000
                }
 
                /// <summary>
@@ -405,6 +444,16 @@ namespace System {
                /// </summary>
                public static string GetFolderPath (SpecialFolder folder)
                {
+                       return GetFolderPath (folder, SpecialFolderOption.None);
+               }
+#if NET_4_0
+               [MonoTODO ("Figure out the folder path for all the new values in SpecialFolder. Use the 'option' argument.")]
+               public
+#endif
+               static string GetFolderPath(SpecialFolder folder, SpecialFolderOption option)
+               {
+                       SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
+
                        string dir = null;
 
                        if (Environment.IsRunningOnWindows) {
@@ -656,13 +705,33 @@ namespace System {
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal static extern void InternalSetEnvironmentVariable (string variable, string value);
-
-               [MonoTODO ("Not implemented")]
+#endif
                [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode=true)]
                public static void FailFast (string message)
                {
                        throw new NotImplementedException ();
                }
+
+#if NET_4_0 || MOONLIGHT
+               [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?
+               }
+
+               public static bool Is64BitProcess {
+                       get { return Is64BitOperatingSystem; }
+               }
+
+               public static int SystemPageSize {
+                       get { return GetPageSize (); }
+               }
 #endif
 
                public static extern int ProcessorCount {
@@ -708,6 +777,9 @@ namespace System {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal extern static string internalGetHome ();
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               internal extern static int GetPageSize ();
+
                static internal bool IsUnix {
                        get {
                                int platform = (int) Environment.Platform;