public static AssemblyCSharpBuilder IgnoreCompilerError(this AssemblyCSharpBuilder builder)
 {
     builder.CompileErrorBehavior = ExceptionBehavior.None;
     return(builder);
 }
 public static AssemblyCSharpBuilder ForceAddSyntax(this AssemblyCSharpBuilder builder)
 {
     builder.SyntaxErrorBehavior = ExceptionBehavior.Ignore;
     return(builder);
 }
 public static AssemblyCSharpBuilder CustomUsing(this AssemblyCSharpBuilder builder)
 {
     builder.CustomUsingShut = true;
     return(builder);
 }
 public static AssemblyCSharpBuilder ThrowAndLogCompilerError(this AssemblyCSharpBuilder builder)
 {
     builder.CompileErrorBehavior = ExceptionBehavior.Log | ExceptionBehavior.Throw;
     return(builder);
 }
 public static T GetDelegateFromShortName <T>(this AssemblyCSharpBuilder builder, string typeName, string methodName, object target = null) where T : Delegate
 {
     return((T)GetDelegateFromShortName(builder, typeName, methodName, typeof(T), target));
 }
 public static AssemblyCSharpBuilder AutoUsing(this AssemblyCSharpBuilder builder)
 {
     builder.CustomUsingShut = false;
     return(builder);
 }
 public static AssemblyCSharpBuilder UseStreamCompile(this AssemblyCSharpBuilder builder)
 {
     builder.Compiler.AssemblyOutputKind = AssemblyBuildKind.Stream;
     return(builder);
 }
 public static AssemblyCSharpBuilder LogCompilerError(this AssemblyCSharpBuilder builder)
 {
     builder.Compiler.ErrorBehavior = ExceptionBehavior.Log;
     return(builder);
 }
 public static AssemblyCSharpBuilder SetRetryLimit(this AssemblyCSharpBuilder builder, int maxRetry)
 {
     builder.RetryLimit = maxRetry;
     return(builder);
 }
 public static AssemblyCSharpBuilder SetOutputFolder(this AssemblyCSharpBuilder builder, string folder)
 {
     builder.OutputFolder = folder;
     return(builder);
 }
 public static AssemblyCSharpBuilder SetAssemblyName(this AssemblyCSharpBuilder builder, string assemblyName)
 {
     builder.Compiler.AssemblyName = assemblyName;
     return(builder);
 }
 public static AssemblyCSharpBuilder AddRetryHandler(this AssemblyCSharpBuilder builder, string key, Action <CompilationException, Diagnostic, NatashaCSharpSyntax, Dictionary <string, string> > action)
 {
     NatashaCSharpEngine.ErrorHandlers[key] = action;
     return(builder);
 }
 public static AssemblyCSharpBuilder ThrowSyntaxError(this AssemblyCSharpBuilder builder)
 {
     builder.Syntax.ErrorBehavior = ExceptionBehavior.Throw;
     return(builder);
 }
 public static AssemblyCSharpBuilder LogSyntaxError(this AssemblyCSharpBuilder builder)
 {
     builder.SyntaxErrorBehavior = ExceptionBehavior.Log;
     return(builder);
 }
 /// <summary>
 /// 添加编译错误处理程序
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="key">错误ID,例如:CS0246</param>
 /// <param name="action"> Func<错误集合,语法树控制器,源代码,新代码(返回)> </param>
 /// <returns></returns>
 public static AssemblyCSharpBuilder AddUsingAnalysistor(this AssemblyCSharpBuilder builder, string key, Func <Diagnostic, IEnumerable <UsingDirectiveSyntax> > action)
 {
     UsingAnalysistorManagement.Add(key, action);
     return(builder);
 }
 public static AssemblyCSharpBuilder IgnoreSyntaxError(this AssemblyCSharpBuilder builder)
 {
     builder.SyntaxErrorBehavior = ExceptionBehavior.None;
     return(builder);
 }
 public static T GetDelegateFromFullName <T>(this AssemblyCSharpBuilder builder, string typeName, string methodName, object binder = null) where T : Delegate
 {
     return((T)GetDelegateFromFullName(builder, typeName, methodName, typeof(T), binder));
 }