public IProcessTransformationRunner CreateTransformationRunner() { return(runFactory.CreateTransformationRunner()); }
protected virtual IProcessTransformationRunner CompileAndPrepareRunner(ParsedTemplate pt, string content, ITextTemplatingEngineHost host, IProcessTransformationRunFactory runFactory, TemplateSettings settings) { TransformationRunner runner = null; bool success = false; if (pt == null) { throw new ArgumentNullException(nameof(pt)); } if (host == null) { throw new ArgumentNullException(nameof(host)); } if (runFactory == null) { throw new ArgumentNullException(nameof(runFactory)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } try { try { if (runFactory.CreateTransformationRunner() is TransformationRunner theRunner) { runner = theRunner; } } catch (Exception ex) { if (IsCriticalException(ex)) { throw; } pt.LogError(ex.ToString(), new Location(host.TemplateFile)); } if (runner != null && !runner.Errors.HasErrors) { // reference the assemblies and ensure they are path rooted settings.SetAssemblies(ProcessReferences(host, pt, settings)); if (!pt.Errors.HasErrors) { try { success = runFactory.PrepareTransformation(runner.RunnerId, pt, content, host, settings); } catch (SerializationException) { pt.LogError(VsTemplatingErrorResources.SessionHostMarshalError, new Location(host.TemplateFile)); throw; } } } } catch (Exception ex) { if (IsCriticalException(ex)) { throw; } pt.LogError(ex.ToString(), new Location(host.TemplateFile, -1, -1)); } finally { if (runner != null) { pt.Errors.AddRange(runFactory.GetErrors(runner.RunnerId)); } } return(success ? runner : null); }