示例#1
0
 public static void UnregisterRuntime(MonoTargetRuntime runtime)
 {
     MonoTargetRuntimeFactory.UnregisterRuntime(runtime);
 }
示例#2
0
        public IEnumerable <TargetRuntime> CreateRuntimes()
        {
            MonoRuntimeInfo currentRuntime = MonoRuntimeInfo.FromCurrentRuntime();

            if (currentRuntime != null)
            {
                yield return(new MonoTargetRuntime(currentRuntime));
            }
            if (Platform.IsWindows)
            {
                string progs = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                foreach (string dir in Directory.GetDirectories(progs, "Mono-*"))
                {
                    MonoRuntimeInfo info = new MonoRuntimeInfo(dir);
                    if (info.IsValidRuntime)
                    {
                        yield return(new MonoTargetRuntime(info));
                    }
                }
            }
            else if (Platform.IsMac)
            {
                if (!Directory.Exists(MAC_FRAMEWORK_DIR))
                {
                    yield break;
                }
                foreach (string dir in Directory.GetDirectories(MAC_FRAMEWORK_DIR))
                {
                    if (dir.EndsWith("/Current") || currentRuntime.Prefix == dir)
                    {
                        continue;
                    }
                    MonoRuntimeInfo info = new MonoRuntimeInfo(dir);
                    if (info.IsValidRuntime)
                    {
                        yield return(new MonoTargetRuntime(info));
                    }
                }
            }
            else
            {
                foreach (string pref in commonLinuxPrefixes)
                {
                    if (currentRuntime != null && currentRuntime.Prefix == pref)
                    {
                        continue;
                    }
                    MonoRuntimeInfo info = new MonoRuntimeInfo(pref);
                    if (info.IsValidRuntime)
                    {
                        // Clean up old registered runtimes
                        foreach (MonoRuntimeInfo ei in customRuntimes)
                        {
                            if (ei.Prefix == info.Prefix)
                            {
                                customRuntimes.Remove(ei);
                                break;
                            }
                        }
                        yield return(new MonoTargetRuntime(info));
                    }
                }
            }
            foreach (MonoRuntimeInfo info in customRuntimes)
            {
                MonoTargetRuntime rt = new MonoTargetRuntime(info);
                rt.UserDefined = true;
                yield return(rt);
            }
        }