Ejemplo n.º 1
0
 private static bool Compile(
     IEnumerable <I18nTextSourceFile> srcFiles,
     I18nTextCompilerOptions options,
     Action <I18nTextCompilerOptions, IEnumerable <I18nTextCompileItem> > beforeCompile,
     Action <I18nTextCompilerOptions, I18nTextCompileItem, IEnumerable <string> > saveCode,
     CancellationToken cancellationToken)
 {
     try
     {
         var i18textSrc = I18nTextSourceFile.Parse(srcFiles, options, cancellationToken);
         OutputI18nTextJsonFiles(options, i18textSrc, cancellationToken);
         OutputTypesFiles(options, i18textSrc, beforeCompile, saveCode, cancellationToken);
         return(true);
     }
     catch (AggregateException e) when(e.InnerException is I18nTextCompileException compileException)
     {
         options.LogError(compileException);
         return(false);
     }
     catch (I18nTextCompileException compileException)
     {
         options.LogError(compileException);
         return(false);
     }
 }
Ejemplo n.º 2
0
 public bool Compile(IEnumerable <I18nTextSourceFile> srcFiles, I18nTextCompilerOptions options)
 {
     try
     {
         var i18textSrc = ParseSourceFiles(srcFiles, options);
         OutputTypesFiles(options, i18textSrc);
         OutputI18nTextJsonFiles(options, i18textSrc);
         return(true);
     }
     catch (AggregateException e) when(e.InnerException is I18nTextCompileException compileException)
     {
         options.LogError(compileException.Message);
         return(false);
     }
     catch (I18nTextCompileException compileException)
     {
         options.LogError(compileException.Message);
         return(false);
     }
 }