1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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;
- namespace FastReport.Utils
- {
- /// <summary>
- /// Specifies the behaviour of compiler when exception is thrown.
- /// </summary>
- public enum CompilerExceptionBehaviour
- {
- /// <summary>
- /// Default behaviour. Throw exception.
- /// </summary>
- Default,
- /// <summary>
- /// Show exception message and replace incorrect expression by <b>Placeholder</b>.
- /// </summary>
- ShowExceptionMessage,
- /// <summary>
- /// Replace expression with exception message. Don't show any messages.
- /// </summary>
- ReplaceExpressionWithExceptionMessage,
- /// <summary>
- /// Replace exception with <b>Placeholder</b> value. Don't show any messages.
- /// </summary>
- ReplaceExpressionWithPlaceholder
- }
- /// <summary>
- /// Contains compiler settings.
- /// </summary>
- public class CompilerSettings
- {
- #region Fields
- private string placeholder;
- private CompilerExceptionBehaviour exceptionBehaviour;
- #endregion Fields
- #region Properties
- /// <summary>
- /// Gets or set the string that will be used for replacing incorrect expressions.
- /// </summary>
- public string Placeholder
- {
- get { return placeholder; }
- set { placeholder = value; }
- }
- /// <summary>
- /// Gets or sets the behaviour of compiler when exception is thrown.
- /// </summary>
- public CompilerExceptionBehaviour ExceptionBehaviour
- {
- get { return exceptionBehaviour; }
- set { exceptionBehaviour = value; }
- }
- #endregion Properties
- #region Constructors
- /// <summary>
- /// Initializes a new instance of the <see cref="CompilerSettings"/> class.
- /// </summary>
- public CompilerSettings()
- {
- placeholder = "";
- exceptionBehaviour = CompilerExceptionBehaviour.Default;
- }
- #endregion Constructors
- }
- }
|