Exemple #1
0
        static MonoCompat()
        {
            Type monoRuntimeType = typeof(object).Assembly.GetType("Mono.Runtime");

            if (monoRuntimeType != null)
            {
                IsMono = true;
                MethodInfo getDisplayNameMethod = monoRuntimeType.GetMethod("GetDisplayName", MonoMethodFlags, null, Type.EmptyTypes, null);
                if (getDisplayNameMethod != null)
                {
                    MonoVersionString = (string)getDisplayNameMethod.Invoke(null, null);
                    try {
                        string[] parts    = MonoVersionString.Split('.');
                        int      major    = Int32.Parse(parts[0]);
                        int      minor    = Int32.Parse(parts[1]);
                        int      revision = Int32.Parse(parts[2].Substring(0, parts[2].IndexOf(' ')));
                        MonoVersion = new Version(major, minor, revision);
                        IsSGen      = (major == 2 && minor > 6);
                    } catch (Exception) {
                        Logger.Log("Could not parse Mono version.", LogType.Error);
                        MonoVersion = null;
                        IsSGen      = false;
                    }
                }
                else
                {
                    AssumeUnknownMonoVersion();
                }
            }
            else
            {
                IsMono = false;
                AssumeUnknownMonoVersion();
            }

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.MacOSX:
            case PlatformID.Unix:
                IsWindows = false;
                break;

            default:
                IsWindows = true;
                break;
            }

            IsCaseSensitive = !IsWindows;
        }
Exemple #2
0
        static MonoCompat()
        {
            Type monoRuntimeType = typeof(object).Assembly.GetType("Mono.Runtime");

            if (monoRuntimeType != null)
            {
                IsMono = true;
                MethodInfo getDisplayNameMethod = monoRuntimeType.GetMethod("GetDisplayName", MonoMethodFlags, null, Type.EmptyTypes, null);
                if (getDisplayNameMethod != null)
                {
                    MonoVersionString = (string)getDisplayNameMethod.Invoke(null, null);
                    try {
                        string[] parts    = MonoVersionString.Split('.');
                        int      major    = Int32.Parse(parts[0]);
                        int      minor    = Int32.Parse(parts[1]);
                        int      revision = Int32.Parse(parts[2].Substring(0, parts[2].IndexOf(' ')));
                        MonoVersion   = new Version(major, minor, revision);
                        IsSGenCapable = (major == 2 && minor >= 8);
                    } catch (Exception ex) {
                        throw new Exception(UnsupportedMessage, ex);
                    }

                    if (MonoVersion.Major < 2 && MonoVersion.Major < 6)
                    {
                        throw new Exception(UnsupportedMessage);
                    }
                }
                else
                {
                    throw new Exception(UnsupportedMessage);
                }
            }

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.MacOSX:
            case PlatformID.Unix:
                IsMono    = true;
                IsWindows = false;
                break;

            default:
                IsWindows = true;
                break;
            }

            IsCaseSensitive = !IsWindows;
        }