Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     if (args.Length != 1)
     {
         MessageBox.Show("This tool can only be called with one parameter");
         return;
     }
     try
     {
         BrowserSelector bs      = new BrowserSelector();
         BrowserInfo     browser = bs.FindBrowser(args[0]);
         try
         {
             Process.Start(browser.Path,
                           string.Format("{0} \"{1}\"", browser.Flags, args[0]));
         }
         catch (Win32Exception we)
         {
             throw new ConfigException("The browser " + browser + " was not found! " + we.ToString());
         }
     }
     catch (ConfigException e)
     {
         MessageBox.Show("The config is incorrect: " + e.ToString());
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
 }
Ejemplo n.º 2
0
        private BrowserInfo GetBrowserInfo(string browser)
        {
            BrowserInfo bi = new BrowserInfo();

            if (data.Sections.Where(s => (s.SectionName == browser)).Count() != 0)
            {
                if (data[browser].ContainsKey("path"))
                {
                    bi.Path = data[browser]["path"];
                }
                else
                {
                    throw new ConfigException("Path is needed for Browser");
                }
                if (data[browser].ContainsKey("flags"))
                {
                    bi.Flags = data[browser]["flags"];
                }
                else
                {
                    bi.Flags = "";
                }
            }
            else
            {
                if (data["browsers"].ContainsKey(browser))
                {
                    bi.Flags = "";
                    bi.Path  = data["browsers"][browser];
                }
                else
                {
                    throw new ConfigException("Cannot find browser config");
                }
            }
            return(bi);
        }