BrowserSelect.Program.Args2Str C# (CSharp) Метод

Args2Str() публичный статический Метод

public static Args2Str ( List args ) : string
args List
Результат string
        public static string Args2Str(List<string> args)
        {
            return Args2Str(args.ToArray());
        }

Same methods

Program::Args2Str ( string args ) : string

Usage Example

Пример #1
0
        public static void open_url(Browser b, bool incognito = false)
        {
            var args = new List <string>();

            if (!string.IsNullOrEmpty(b.additionalArgs))
            {
                args.Add(b.additionalArgs);
            }
            if (incognito)
            {
                args.Add(b.private_arg);
            }
            if (b.exec.ToLower().EndsWith("brave.exe"))
            {
                args.Add("--");
            }
            args.Add(Program.url.Replace("\"", "%22"));

            if (b.exec.EndsWith("iexplore.exe") && !incognito)
            {
                // IE tends to open in a new window instead of a new tab
                // code borrowed from http://stackoverflow.com/a/3713470/1461004
                bool         found = false;
                ShellWindows iExplorerInstances = new ShellWindows();
                foreach (InternetExplorer iExplorer in iExplorerInstances)
                {
                    if (iExplorer.Name.EndsWith("Internet Explorer"))
                    {
                        iExplorer.Navigate(Program.url, 0x800);
                        // for issue #10 (bring IE to focus after opening link)
                        ForegroundAgent.RestoreWindow(iExplorer.HWND);
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    Process.Start(b.exec, Program.Args2Str(args));
                }
            }
            else
            {
                ProcessStartInfo startInfo = new ProcessStartInfo(b.exec);
                // Clicking MS Edge takes more than 4 seconds to load, even with an existing window
                // Disabling UseShellExecute to create the process directly from the browser executable file
                startInfo.UseShellExecute = false;
                startInfo.Arguments       = Program.Args2Str(args);
                Process.Start(startInfo);
            }
            Application.Exit();
        }
All Usage Examples Of BrowserSelect.Program::Args2Str