Exemplo n.º 1
0
        public int Execute(IMetaGenerator metaTypeGenerator, InvocationContext context)
        {
            var result = ExitCode.Success;

            _assemblyProvider.PluginAssembly = metaTypeGenerator.GetType().Assembly;

            try
            {
                _timeKeeper.MeasureTime(metaTypeGenerator.Register, "Registration");

                if (VerifyTools())
                {
                    _userInputProvider.AskUser(UserArguments(context));

                    _timeKeeper.MeasureTime(metaTypeGenerator.Prepare, "Prepartion");
                    _timeKeeper.MeasureTime(metaTypeGenerator.Generate, "Generation");
                    _timeKeeper.MeasureTime(metaTypeGenerator.TearDown, "Tear down");
                }
                else
                {
                    result = ExitCode.ToolMissing;
                }

                _timeKeeper.Print();
            }
            catch (Exception exception)
            {
                _exceptionFormatter.FormatException(exception);
                result = ExitCode.ExceptionOccured;
            }

            return(result);
        }