示例#1
0
        public override CompilerResults CompileAssemblyFromFile(CompilerParameters options, params string[] fileNames)
        {
            var units = new CodeCompileUnit[fileNames.Length];
            var errors = new CompilerErrorCollection();
            var syntax = new Parser(options);

            for (int i = 0; i < fileNames.Length; i++)
            {
                try
                {
                    units[i] = syntax.Parse(new StreamReader(fileNames[i]), fileNames[i]);
                }
#if !DEBUG
                catch (ParseException e)
                {
                    errors.Add(new CompilerError(e.Source, e.Line, 0, e.Message.GetHashCode().ToString(), e.Message));
                }
                catch (Exception e)
                {
                    errors.Add(new CompilerError { ErrorText = e.Message });
                }
#endif
                finally { }
            }

            var results = CompileAssemblyFromDom(options, units);
            results.Errors.AddRange(errors);

            return results;
        }
示例#2
0
        CompilerResults CompileAssemblyFromReaderBatch(CompilerParameters options, TextReader[] readers)
        {
            var units = new CodeCompileUnit[readers.Length];
            var syntax = new Parser(options);

            for (int i = 0; i < readers.Length; i++)
                units[i] = syntax.Parse(readers[i]);

            return CompileAssemblyFromDomBatch(options, units);
        }