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

public static ExecWaitWithCapture ( IntPtr userToken, string cmd, TempFileCollection tempFiles, string &outputName, string &errorName ) : int
userToken System.IntPtr
cmd string
tempFiles TempFileCollection
outputName string
errorName string
Результат int
Пример #1
0
        internal void Compile(CompilerParameters options, string compilerDirectory, string compilerExe, string arguments, ref string outputFile, ref int nativeReturnValue, string trueArgs)
        {
            string errorName = null;

            outputFile = options.TempFiles.AddExtension("out");
            string path = Path.Combine(compilerDirectory, compilerExe);

            if (!File.Exists(path))
            {
                throw new InvalidOperationException(SR.GetString("CompilerNotFound", new object[] { path }));
            }
            string trueCmdLine = null;

            if (trueArgs != null)
            {
                trueCmdLine = "\"" + path + "\" " + trueArgs;
            }
            nativeReturnValue = Executor.ExecWaitWithCapture(options.SafeUserToken, "\"" + path + "\" " + arguments, Environment.CurrentDirectory, options.TempFiles, ref outputFile, ref errorName, trueCmdLine);
        }
Пример #2
0
        private CompilerResults Compile(CompilerParameters options, string[] fileNames, bool keepFiles)
        {
            if (null == options)
            {
                throw new ArgumentNullException("options");
            }
            if (null == fileNames)
            {
                throw new ArgumentNullException("fileNames");
            }

            options.TempFiles = new TempFileCollection();
            foreach (string file in fileNames)
            {
                options.TempFiles.AddFile(file, keepFiles);
            }
            options.TempFiles.KeepFiles = keepFiles;

            string std_output = String.Empty;
            string err_output = String.Empty;
            string cmd        = String.Concat(CompilerName, " ", CmdArgsFromParameters(options));

            CompilerResults results = new CompilerResults(new TempFileCollection());

            results.NativeCompilerReturnValue = Executor.ExecWaitWithCapture(cmd,
                                                                             options.TempFiles, ref std_output, ref err_output);

            string[] compiler_output_lines = std_output.Split(Environment.NewLine.ToCharArray());
            foreach (string error_line in compiler_output_lines)
            {
                ProcessCompilerOutputLine(results, error_line);
            }

            if (results.Errors.Count == 0)
            {
                results.PathToAssembly = options.OutputAssembly;
            }
            return(results);
        }
Пример #3
0
        internal void Compile(CompilerParameters options, string compilerDirectory, string compilerExe, string arguments, ref string outputFile, ref int nativeReturnValue, string trueArgs)
        {
            string errorFile = null;

            outputFile = options.TempFiles.AddExtension("out");

            // We try to execute the compiler with a full path name.
            string fullname = compilerDirectory + compilerExe;

            if (File.Exists(fullname))
            {
                string trueCmdLine = null;
                if (trueArgs != null)
                {
                    trueCmdLine = "\"" + fullname + "\" " + trueArgs;
                }
                nativeReturnValue = Executor.ExecWaitWithCapture(options.UserToken, "\"" + fullname + "\" " + arguments, options.TempFiles, ref outputFile, ref errorFile, trueCmdLine);
            }
            else
            {
                throw new InvalidOperationException(SR.GetString(SR.CompilerNotFound, fullname));
            }
        }