示例#1
0
        /*
         * @see Flash.Tools.Debugger.SessionManager#playerForUri(java.lang.String)
         */
        public override Player playerForUri(String url)
        {
            // Find the Netscape plugin
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                FileInfo flashPlugin = new FileInfo("/Library/Internet Plug-Ins/Flash Player.plugin");                 //$NON-NLS-1$
                return(new NetscapePluginPlayer(m_debuggerCallbacks.getHttpExe(), flashPlugin));
            }
            else
            {
                LaunchInfo launchInfo = new LaunchInfo(this, url);
                if (launchInfo.WebBrowserNativeLaunch())
                {
                    FileInfo httpExe = m_debuggerCallbacks.getHttpExe();
                    if (httpExe.Name.ToUpper().Equals("iexplore.exe".ToUpper()))
                    //$NON-NLS-1$
                    {
                        // IE on Windows: Find the ActiveX control
                        String activeXFile = null;
                        try
                        {
                            activeXFile = m_debuggerCallbacks.queryWindowsRegistry("HKEY_CLASSES_ROOT\\CLSID\\{D27CDB6E-AE6D-11cf-96B8-444553540000}\\InprocServer32", null);                             //$NON-NLS-1$
                        }
                        catch (IOException)
                        {
                            // ignore
                        }
                        if (activeXFile == null)
                        {
                            return(null);                            // we couldn't find the player
                        }
                        FileInfo file = new FileInfo(activeXFile);
                        return(new ActiveXPlayer(httpExe, file));
                    }
                    else
                    {
                        // Find the Netscape plugin
                        FileInfo browserDir = new FileInfo(httpExe.DirectoryName);

                        // Opera puts plugins under "program\plugins" rather than under "plugins"
                        if (httpExe.Name.ToUpper().Equals("opera.exe".ToUpper()))
                        {
                            //$NON-NLS-1$
                            browserDir = new FileInfo(browserDir.FullName + "\\" + "program");                             //$NON-NLS-1$
                        }
                        FileInfo pluginsDir  = new FileInfo(browserDir.FullName + "\\" + "plugins");                       //$NON-NLS-1$
                        FileInfo flashPlugin = new FileInfo(pluginsDir.FullName + "\\" + "NPSWF32.dll");                   // WARNING, Windows-specific //$NON-NLS-1$

                        // Bug 199175: The player is now installed via a registry key, not
                        // in the "plugins" directory.
                        //
                        // Although Mozilla does not document this, the actual behavior of
                        // the browser seems to be that it looks first in the "plugins" directory,
                        // and then, if the file is not found there, it looks in the registry.
                        // So, we mimic that behavior.
                        bool tmpBool;
                        if (File.Exists(flashPlugin.FullName))
                        {
                            tmpBool = true;
                        }
                        else
                        {
                            tmpBool = Directory.Exists(flashPlugin.FullName);
                        }
                        if (!tmpBool)
                        {
                            FileInfo pathFromRegistry = WindowsMozillaPlayerPathFromRegistry;

                            if (pathFromRegistry != null)
                            {
                                flashPlugin = pathFromRegistry;
                            }
                        }

                        return(new NetscapePluginPlayer(httpExe, flashPlugin));
                    }
                }
                else if (launchInfo.PlayerNativeLaunch())
                {
                    FileInfo playerExe = m_debuggerCallbacks.getPlayerExe();
                    return(new StandalonePlayer(playerExe));
                }
            }

            return(null);
        }