Compile() private method

private Compile ( CompilerParameters options, string partialCmdLine, string sourceFiles, string outputFile ) : int
options System.CodeDom.Compiler.CompilerParameters
partialCmdLine string
sourceFiles string
outputFile string
return int
      protected override CompilerResults FromFileBatch(CompilerParameters options, string[] fileNames){
        string outputFile = options.TempFiles.AddExtension("out");
        CompilerResults results = new CompilerResults(options.TempFiles);

        if (options.OutputAssembly == null || options.OutputAssembly.Length == 0) {
          options.OutputAssembly = results.TempFiles.AddExtension("dll", !options.GenerateInMemory);
        }

        // For debug mode, we construct a command line for debugging with JSC.  The command line is
        // only partially formed at this stage; the rest of it will be added and written to a response
        // file by JSInProcCompiler.

        string partialCmdLine = null;
        if (options.IncludeDebugInformation){
          results.TempFiles.AddExtension("ildb");
          partialCmdLine = this.CmdArgsFromParameters(options);
        }

        results.NativeCompilerReturnValue = 0;
        try {
          JSInProcCompiler jsc = new JSInProcCompiler();
          results.NativeCompilerReturnValue = jsc.Compile(options, partialCmdLine, fileNames, outputFile);
        } catch {
          // internal compiler error
          results.NativeCompilerReturnValue = 10;
        }

        // parse the output looking for errors and warnings
        try {
          StreamReader compilerOutput = new StreamReader(outputFile);
          try {
            string line = compilerOutput.ReadLine();
            while (line != null) {
              results.Output.Add(line);
              ProcessCompilerOutputLine(results, line);
              line = compilerOutput.ReadLine();
            }
          } finally {
            compilerOutput.Close();
          }
        }catch(Exception e){
          // could not open output file -- provide some other error information
          results.Output.Add(JScriptException.Localize("No error output", CultureInfo.CurrentUICulture));
          results.Output.Add(e.ToString());
        }catch{
          // could not open output file -- provide some other error information
          results.Output.Add(JScriptException.Localize("No error output", CultureInfo.CurrentUICulture));
        }
        if ((results.NativeCompilerReturnValue == 0) && options.GenerateInMemory) {
          FileStream fs = new FileStream(options.OutputAssembly, FileMode.Open, FileAccess.Read, FileShare.Read);
          try {
            int fileLen = (int)fs.Length;
            byte[] b = new byte[fileLen];
            fs.Read(b, 0, fileLen);
            results.CompiledAssembly = Assembly.Load(b, null, options.Evidence);
          }finally {
            fs.Close();
          }
        }else{
          results.PathToAssembly = Path.GetFullPath(options.OutputAssembly);
        }
        results.Evidence = options.Evidence;
        return results;
      }