Example #1
0
        public static bool AddChoice(string ext, string[] paths, string[] captions, int hotkeyI)
        {
            string sExeNow = null;
            int    foundI  = -1;

            Console.Error.WriteLine("checking for program for " + ext);
            for (int index = 0; index < paths.Length; index++)
            {
                try {
                    if (File.Exists(paths[index]))
                    {
                        sExeNow = paths[index];
                        Console.Error.WriteLine("found " + sExeNow);
                        foundI = index;
                    }
                    else
                    {
                        Console.Error.WriteLine("no " + paths[index]);
                    }
                }
                catch {
                    if (paths[index] != null)
                    {
                        Console.Error.WriteLine("Path "
                                                + index.ToString()
                                                + " is bad for "
                                                + ext + ": \""
                                                + paths[index] + "\"");
                    }
                    else
                    {
                        Console.Error.WriteLine("Path "
                                                + index.ToString()
                                                + " is bad for "
                                                + ext);
                    }
                }                 // if path is bad, don't care
            }
            if (sExeNow != null)
            {
                ProgChooser.ForceAddChoice("sln", sExeNow, captions[foundI], hotkeyI);
            }
            else
            {
                // ALWAYS add it, so that the number key corresponding
                // to kotkeyI opens the matching sequential version.
                ProgChooser.ForceAddChoice("sln", paths[0], "NONE (no " + captions[0] + " found)", hotkeyI);
            }
            return(sExeNow != null);
        }