Beispiel #1
0
        /// <summary>
        /// Run the compilation
        /// </summary>
        /// <returns>
        /// The <see cref="CompilerResults" />.
        /// </returns>
        public ICompilerResults Run()
        {
            Log.Info(string.Format("Requesting compile of {0} from {1}...", this.fileName, this.compilerUrl));
            Log.Info(string.Empty);

            // Setup compiler dependencies
            var inputStream            = new StreamReader(this.fileName);
            var request                = WebRequest.Create(this.compilerUrl);
            var compilerOptions        = new CompilerOptions(inputStream, request, this.compilationLevel);
            var compilationLevelHelper = new CompilationLevelHelper();

            var compiler           = new JavaScriptCompiler(compilerOptions, compilationLevelHelper);
            var responseFromServer = compiler.Compile();

            var deserializer    = new ResultsDeserializer(new JavaScriptSerializer());
            var compilerResults = deserializer.DeserializeCompilerResults(responseFromServer, this.fileName);

            compilerResults.SupressWarningsFrom(this.suppressedWarnings);
            compilerResults.Emit(this.resultsEmitters);

            return(compilerResults);
        }
        /// <summary>
        /// Run the compilation
        /// </summary>
        /// <returns>
        /// The <see cref="CompilerResults" />.
        /// </returns>
        public ICompilerResults Run()
        {
            Log.Info(string.Format("Requesting compile of {0} from {1}...", this.fileName, this.compilerUrl));
            Log.Info(string.Empty);

            // Setup compiler dependencies
            var inputStream = new StreamReader(this.fileName);
            var request = WebRequest.Create(this.compilerUrl);
            var compilerOptions = new CompilerOptions(inputStream, request, this.compilationLevel);
            var compilationLevelHelper = new CompilationLevelHelper();

            var compiler = new JavaScriptCompiler(compilerOptions, compilationLevelHelper);
            var responseFromServer = compiler.Compile();

            var deserializer = new ResultsDeserializer(new JavaScriptSerializer());
            var compilerResults = deserializer.DeserializeCompilerResults(responseFromServer, this.fileName);

            compilerResults.SupressWarningsFrom(this.suppressedWarnings);
            compilerResults.Emit(this.resultsEmitters);

            return compilerResults;
        }