/// <summary>
 /// Constructor
 /// </summary>
 public MonoStartDebuggingOptions()
 {
     if (IntPtr.Size == 4)
     {
         MonoExeOptions = MonoExeOptions.Prefer32 | MonoExeOptions.Debug32 | MonoExeOptions.Debug64;
     }
     else
     {
         MonoExeOptions = MonoExeOptions.Prefer64 | MonoExeOptions.Debug32 | MonoExeOptions.Debug64;
     }
 }
Example #2
0
        static void Find(MonoExeOptions options, out string mono32, out string mono64)
        {
            mono32 = null;
            mono64 = null;
            foreach (var dir in GetDirectories())
            {
                bool has32 = mono32 != null || (options & MonoExeOptions.Debug32) == 0;
                bool has64 = mono64 != null || (options & MonoExeOptions.Debug64) == 0;
                if (has32 && has64)
                {
                    break;
                }
                if (!Directory.Exists(dir))
                {
                    continue;
                }
                try {
                    var file = Path.Combine(dir, MONO_EXE);
                    if (!File.Exists(file))
                    {
                        continue;
                    }
                    switch (GetPeFileBitness(file))
                    {
                    case 32:
                        if (mono32 == null)
                        {
                            mono32 = file;
                        }
                        break;

                    case 64:
                        if (mono64 == null)
                        {
                            mono64 = file;
                        }
                        break;
                    }
                }
                catch {
                }
            }
        }
Example #3
0
        public static string Find(MonoExeOptions options)
        {
            if ((options & (MonoExeOptions.Prefer32 | MonoExeOptions.Prefer64)) == 0)
            {
                if (IntPtr.Size == 4)
                {
                    options |= MonoExeOptions.Prefer32;
                }
                else
                {
                    options |= MonoExeOptions.Prefer64;
                }
            }

            Find(options, out var mono32, out var mono64);

            if ((options & MonoExeOptions.Prefer32) != 0 && (options & MonoExeOptions.Debug32) != 0 && mono32 != null)
            {
                return(mono32);
            }
            if ((options & MonoExeOptions.Prefer64) != 0 && (options & MonoExeOptions.Debug64) != 0 && mono64 != null)
            {
                return(mono64);
            }

            if ((options & MonoExeOptions.Debug32) != 0 && mono32 != null)
            {
                return(mono32);
            }
            if ((options & MonoExeOptions.Debug64) != 0 && mono64 != null)
            {
                return(mono64);
            }

            return(null);
        }