BooC.App.Run C# (CSharp) Method

Run() public method

public Run ( string args ) : int
args string
return int
        public int Run(string[] args)
        {
            int resultCode = 127;

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve);

            CheckBooCompiler();

            try
            {
                Stopwatch setupTime = Stopwatch.StartNew();

                _options = new CompilerParameters(false); //false means no stdlib loading yet
                _options.GenerateInMemory = false;

                ArrayList tempLibPaths = _options.LibPaths.Clone() as ArrayList;
                _options.LibPaths.Clear();

                BooCompiler compiler = new BooCompiler(_options);

                ParseOptions(args);

                if (0 == _options.Input.Count)
                {
                    throw new ApplicationException(Boo.Lang.ResourceManager.GetString("BooC.NoInputSpecified"));
                }

                //move standard libpaths below any new ones:
                foreach(object o in tempLibPaths)
                    _options.LibPaths.Add(o);

                if (_options.StdLib)
                {
                    _options.LoadDefaultReferences();
                }
                else if (!_noConfig)
                {
                    _references.Insert(0, "mscorlib");
                }

                LoadReferences();
                ConfigurePipeline();

                if (_options.TraceInfo)
                {
                    compiler.Parameters.Pipeline.BeforeStep += new CompilerStepEventHandler(OnBeforeStep);
                    compiler.Parameters.Pipeline.AfterStep += new CompilerStepEventHandler(OnAfterStep);
                }

                setupTime.Stop();

                Stopwatch processingTime = Stopwatch.StartNew();
                CompilerContext context = compiler.Run();
                processingTime.Stop();

                if (context.Warnings.Count > 0)
                {
                    Console.Error.WriteLine(context.Warnings);
                    Console.Error.WriteLine(Boo.Lang.ResourceManager.Format("BooC.Warnings", context.Warnings.Count));
                }

                if (context.Errors.Count > 0)
                {
                    foreach (CompilerError error in context.Errors)
                    {
                        Console.Error.WriteLine(error.ToString(_options.TraceInfo));
                    }
                    Console.Error.WriteLine(Boo.Lang.ResourceManager.Format("BooC.Errors", context.Errors.Count));
                }
                else
                {
                    resultCode = 0;
                }

                if (_options.TraceWarning)
                {
                    Console.Error.WriteLine(Boo.Lang.ResourceManager.Format("BooC.ProcessingTime", _options.Input.Count, processingTime.ElapsedMilliseconds, setupTime.ElapsedMilliseconds));
                }
            }
            catch (Exception x)
            {
                object message = (_options.TraceWarning)
                                    ? (object)x : (object)x.Message;
                Console.Error.WriteLine(Boo.Lang.ResourceManager.Format("BooC.FatalError", message));
            }
            return resultCode;
        }