Beispiel #1
0
        public static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Usage:  SolutionTransform <scriptPath> <solutionPath>");
            }
            else
            {
                try
                {
                    var interpreter = new Boo.Lang.Interpreter.InteractiveInterpreter2();
                    interpreter.SetValue("solution", GetSolutionFile(args[1]));
                    string scriptFile = args[0];
                    if (!scriptFile.Contains("."))
                    {
                        scriptFile += ".boo";
                    }
                    var script = FullPath(scriptFile).FileContent();

                    var context = interpreter.Eval(script);
                    foreach (var e in context.Errors)
                    {
                        Console.WriteLine(e.ToString());
                    }
                    if (context.Errors.Count != 0)
                    {
                        return(2);
                    }
                } catch (Exception ex) {
                    WriteException(Console.Out, ex);
                    return(1);
                }
            }
            return(0);
        }
		public int Execute(IEnumerable<string> args, IFileStorage fileSystem) {
			
			try {
				var interpreter = new Boo.Lang.Interpreter.InteractiveInterpreter2();

				var parser = new BooCommandLineParser(interpreter, args.ToArray());
				var api10 = new Api(parser, fileSystem);
				// api10.Parameters();

				interpreter.SetValue("api10", api10);

				
				CompilerContext context;
				try {
					context = interpreter.Eval(content);
				} catch (TargetInvocationException ex) {
					if (ex.InnerException == null) {
						throw ex.InnerException;
					}
					throw;
				}
				foreach (var e in context.Errors) {
					Console.WriteLine(e.ToString());
				}
				if (context.Errors.Count != 0) {
					return 2;
				}
			} catch (NonErrorTerminationException) {
				return 0;
			} catch (Exception ex) {
				WriteException(Console.Out, ex);
				return 1;
			}
			return 0;
		}
Beispiel #3
0
		public static int Main(string[] args)
		{
			if (args.Length < 2) {
				Console.WriteLine("Usage:  SolutionTransform <scriptPath> <solutionPath>");
			} else
			{
                try
                {

                    var interpreter = new Boo.Lang.Interpreter.InteractiveInterpreter2();
                    interpreter.SetValue("solution", GetSolutionFile(args[1]));
                    string scriptFile = args[0];
                    if (!scriptFile.Contains("."))
                    {
                        scriptFile += ".boo";
                    }
                    var script = FullPath(scriptFile).FileContent();

                    var context = interpreter.Eval(script);
                    foreach (var e in context.Errors)
                    {
                        Console.WriteLine(e.ToString());
                    }
                    if (context.Errors.Count != 0)
                    {
                        return 2;
                    }
            	} catch (Exception ex) {
                    WriteException(Console.Out, ex);
                    return 1;
                }
			}
            return 0;
		}