using System; #if NETSTANDARD || NETCOREAPP using FastReport.Code.CodeDom.Compiler; using FastReport.Code.CSharp; #else using System.CodeDom.Compiler; using Microsoft.CSharp; #endif using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; using System.Globalization; namespace FastReport.Utils { /// /// Specifies the behaviour of compiler when exception is thrown. /// public enum CompilerExceptionBehaviour { /// /// Default behaviour. Throw exception. /// Default, /// /// Show exception message and replace incorrect expression by Placeholder. /// ShowExceptionMessage, /// /// Replace expression with exception message. Don't show any messages. /// ReplaceExpressionWithExceptionMessage, /// /// Replace exception with Placeholder value. Don't show any messages. /// ReplaceExpressionWithPlaceholder } /// /// Contains compiler settings. /// public class CompilerSettings { #region Fields private string placeholder; private CompilerExceptionBehaviour exceptionBehaviour; #endregion Fields #region Properties /// /// Gets or set the string that will be used for replacing incorrect expressions. /// public string Placeholder { get { return placeholder; } set { placeholder = value; } } /// /// Gets or sets the behaviour of compiler when exception is thrown. /// public CompilerExceptionBehaviour ExceptionBehaviour { get { return exceptionBehaviour; } set { exceptionBehaviour = value; } } /// /// Get or sets number of recompiles /// /// /// Report compiler can try to fix compilation errors and recompile your report again. This property sets the number of such attempts. /// public int RecompileCount { get; set; } = 1; #if REFLECTION_EMIT_COMPILER /// /// Enables faster compiler if the report script hasn't been changed /// public bool ReflectionEmitCompiler { get; set; } = false; #endif #if CROSSPLATFORM || COREWIN // sets by user private CultureInfo cultureInfo; /// /// Sets culture for compiler /// public CultureInfo CultureInfo { get { if(cultureInfo == null) { return Res.CurrentCulture; } return cultureInfo; } set { cultureInfo = value; } } #endif #endregion Properties #region Constructors /// /// Initializes a new instance of the class. /// public CompilerSettings() { placeholder = ""; exceptionBehaviour = CompilerExceptionBehaviour.Default; } #endregion Constructors } }