コード例 #1
0
        internal override Process Start(string workingDirectory)
        {
            string           monoBin  = MonoUtils.GetMonoXsp4();
            string           args     = GetProcessArgs();
            ProcessStartInfo procInfo = GetProcessStartInfo(workingDirectory, monoBin);

            procInfo.CreateNoWindow  = true;
            procInfo.UseShellExecute = false;
            procInfo.EnvironmentVariables["MONO_OPTIONS"] = args;
            procInfo.RedirectStandardOutput = true;

            _proc = Process.Start(procInfo);
            Task.Run(() =>
            {
                while (!_proc.StandardOutput.EndOfStream)
                {
                    string line = _proc.StandardOutput.ReadLine();

                    if (line.StartsWith("Listening on address"))
                    {
                        string url = line.Substring(line.IndexOf(":") + 2).Trim();
                        if (url == "0.0.0.0")
                        {
                            Url = "localhost";
                        }
                        else
                        {
                            Url = url;
                        }
                    }
                    else if (line.StartsWith("Listening on port"))
                    {
                        string port = line.Substring(line.IndexOf(":") + 2).Trim();
                        port        = port.Substring(0, port.IndexOf(" "));
                        Url        += ":" + port;

                        if (line.Contains("non-secure"))
                        {
                            Url = "http://" + Url;
                        }
                        else
                        {
                            Url = "https://" + Url;
                        }

                        RaiseProcessStarted();
                    }


                    logger.Trace(line);
                }
            });

            return(_proc);
        }
コード例 #2
0
        internal override Process Start(string workingDirectory)
        {
            string monoBin = MonoUtils.GetMonoPath();
            var    dirInfo = new DirectoryInfo(workingDirectory);

            string           args     = GetProcessArgs();
            ProcessStartInfo procInfo = GetProcessStartInfo(workingDirectory, monoBin);

            procInfo.Arguments = args + " \"" + _targetExe + "\"";

            _proc = Process.Start(procInfo);
            RaiseProcessStarted();
            return(_proc);
        }
コード例 #3
0
        internal void GeneratePdb2Mdb(string directoryName)
        {
            logger.Trace(directoryName);
            IEnumerable <string> files =
                Directory.GetFiles(directoryName, "*.dll")
                .Concat(Directory.GetFiles(directoryName, "*.exe"))
                .Where(x => !x.Contains("vshost"));

            logger.Trace(files.Count());

            var dirInfo = new DirectoryInfo(directoryName);

            Parallel.ForEach(files, file =>
            {
                try
                {
                    string fileNameWithoutExt = Path.GetFileNameWithoutExtension(file);
                    string pdbFile            = Path.Combine(Path.GetDirectoryName(file), fileNameWithoutExt + ".pdb");
                    if (File.Exists(pdbFile))
                    {
                        logger.Trace("Generate mdb for: " + file);
                        var procInfo = new ProcessStartInfo(MonoUtils.GetPdb2MdbPath(), Path.GetFileName(file));
                        procInfo.WorkingDirectory = dirInfo.FullName;
                        procInfo.UseShellExecute  = false;
                        procInfo.CreateNoWindow   = true;
                        Process proc = Process.Start(procInfo);
                        proc.WaitForExit();
                    }
                }
                catch (Exception ex)
                {
                    logger.Trace(ex);
                }
            });

            logger.Trace("Transformed Debuginformation pdb2mdb");
        }