Ejemplo n.º 1
0
        public bool Execute(DataContext context)
        {
            context.ASTHandlerExceptions.Clear();

            IDictionary<string, object> unitsToAnswers = new Dictionary<string, object>();
            ExporterVisitor exporter = new ExporterVisitor(unitsToAnswers);

            try
            {
                context.RootNode.Accept(exporter);
            }
            catch (QLError ex)
            {
                // Errors preventing exporter from finishing
                context.ASTHandlerExceptions.Add(ex);
                return false;
            }
            finally
            {
                context.ExportableRepresentation = JsonConvert.SerializeObject(unitsToAnswers, Formatting.Indented);
            }

            return !context.ASTHandlerExceptions.Any();
        }
        public bool Execute(DataContext context)
        {
            context.ASTHandlerExceptions.Clear();

            IDictionary <string, object> unitsToAnswers = new Dictionary <string, object>();
            ExporterVisitor exporter = new ExporterVisitor(unitsToAnswers);

            try
            {
                context.RootNode.Accept(exporter);
            }
            catch (QLError ex)
            {
                // Errors preventing exporter from finishing
                context.ASTHandlerExceptions.Add(ex);
                return(false);
            }
            finally
            {
                context.ExportableRepresentation = JsonConvert.SerializeObject(unitsToAnswers, Formatting.Indented);
            }

            return(!context.ASTHandlerExceptions.Any());
        }