Exemplo n.º 1
0
        /// <summary>
        /// Performs text files generation based on the given AST information.
        /// This method calls InitializeGenerator(), composeTextFilesAction(), then FinalizeGenerator().
        /// </summary>
        /// <param name="composeTextFilesAction"></param>
        public void Generate(Action composeTextFilesAction)
        {
            if (this.SetProgressRunning() == false)
            {
                return;
            }

            if (VerifyReadyToGenerate() == false)
            {
                this.SetProgressNotRunning();

                return;
            }

            InitializeGenerator();

            try
            {
                composeTextFilesAction();
            }
            catch (OperationCanceledException e)
            {
                this.ReportError(e);
            }
            finally
            {
                CodeFilesComposer.FinalizeAllFiles();

                FinalizeGenerator();

                this.SetProgressNotRunning();
            }
        }