コード例 #1
0
        public void StartSilverlightApp(CommonProjectNode project, string /*!*/ file, bool debug)
        {
            string webSiteRoot;

            if (project != null)
            {
                webSiteRoot = project.GetWorkingDirectory();
                file        = Path.GetFullPath(Path.Combine(webSiteRoot, file));
            }
            else
            {
                file        = Path.GetFullPath(file);
                webSiteRoot = Path.GetDirectoryName(file);
            }
            webSiteRoot = webSiteRoot.TrimEnd('\\');

            int port = EnsureChiron(webSiteRoot);

            string url = "http://localhost:" + port;

            if (file.StartsWith(webSiteRoot) && file.Length > webSiteRoot.Length && file[webSiteRoot.Length] == '\\')
            {
                url += file.Substring(webSiteRoot.Length).Replace('\\', '/');
            }
            else if (file.StartsWith("\\"))
            {
                url += file.Replace('\\', '/');
            }
            else
            {
                url += '/' + file.Replace('\\', '/');
            }

            StartInBrowser(url, debug ? guidSilvelightDebug : (Guid?)null);
        }
コード例 #2
0
        /// <summary>
        /// Creates process info used to start the project with no debugging.
        /// </summary>
        protected virtual ProcessStartInfo CreateProcessStartInfoNoDebug(CommonProjectNode project, string startupFile)
        {
            string command = CreateCommandLineNoDebug(project, startupFile);

            string interpreter = GetInterpreterExecutableInternal(project);

            command = "/c \"\"" + interpreter + "\" " + command + " & pause\"";
            ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe", command);

            startInfo.WorkingDirectory = project != null?
                                         project.GetWorkingDirectory() :
                                             Path.GetDirectoryName(startupFile);

            //In order to update environment variables we have to set UseShellExecute to false
            startInfo.UseShellExecute = false;
            SetupEnvironment(project, startInfo.EnvironmentVariables);
            return(startInfo);
        }
コード例 #3
0
        //TODO: this method should be protected, but due to IPy bug #19649
        //we keep it temporary public.
        /// <summary>
        /// Sets up debugger information.
        /// </summary>
        public virtual void SetupDebugInfo(ref VsDebugTargetInfo dbgInfo,
                                           CommonProjectNode project, string startupFile)
        {
            dbgInfo.dlo        = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess;
            dbgInfo.bstrExe    = GetInterpreterExecutableInternal(project);
            dbgInfo.bstrCurDir = project != null?
                                 project.GetWorkingDirectory() :
                                     Path.GetDirectoryName(startupFile);

            dbgInfo.bstrArg                   = CreateCommandLineDebug(project, startupFile);
            dbgInfo.bstrRemoteMachine         = null;
            dbgInfo.fSendStdoutToOutputWindow = 0;
            StringDictionary env = new StringDictionary();

            SetupEnvironment(project, env);
            if (env.Count > 0)
            {
                // add any inherited env vars
                var variables = Environment.GetEnvironmentVariables();
                foreach (var key in variables.Keys)
                {
                    string strKey = (string)key;
                    if (!env.ContainsKey(strKey))
                    {
                        env.Add(strKey, (string)variables[key]);
                    }
                }

                //Environemnt variables should be passed as a
                //null-terminated block of null-terminated strings.
                //Each string is in the following form:name=value\0
                StringBuilder buf = new StringBuilder();
                foreach (DictionaryEntry entry in env)
                {
                    buf.AppendFormat("{0}={1}\0", entry.Key, entry.Value);
                }
                buf.Append("\0");
                dbgInfo.bstrEnv = buf.ToString();
            }
            //Set the managed debugger
            dbgInfo.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine;
            dbgInfo.grfLaunch   = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd;
        }