/// <summary> /// Initialize a new instance of the <see cref="App"/> class. /// </summary> /// <param name="appResourcesService">A service with access to local resources.</param> /// <param name="logger">A logger from the built in LoggingFactory.</param> /// <param name="dataService">A service with access to data storage.</param> /// <param name="processService">A service with access to the process.</param> /// <param name="pdfService">A service with access to the PDF generator.</param> /// <param name="profileService">A service with access to profile information.</param> /// <param name="registerService">A service with access to register information.</param> /// <param name="prefillService">A service with access to prefill mechanisms.</param> /// <param name="instanceService">A service with access to instances</param> /// <param name="settings">General settings</param> /// <param name="textService">A service with access to text</param> /// <param name="httpContextAccessor">A context accessor</param> public App( IAppResources appResourcesService, ILogger <App> logger, IData dataService, IProcess processService, IPDF pdfService, IProfile profileService, IRegister registerService, IPrefill prefillService, IInstance instanceService, IOptions <GeneralSettings> settings, IText textService, IHttpContextAccessor httpContextAccessor) : base( appResourcesService, logger, dataService, processService, pdfService, prefillService, instanceService, registerService, settings, profileService, textService, httpContextAccessor) { _logger = logger; _validationHandler = new ValidationHandler(httpContextAccessor); _dataProcessingHandler = new DataProcessingHandler(); _instantiationHandler = new InstantiationHandler(profileService, registerService); _pdfHandler = new PdfHandler(); }
private bool InvokeOnSerializer(DataProcessingHandler processDataAction, string uniqueName, string stringValue, int intValue, float floatValue, ref byte[] data, out string filePath, out Exception exception) { exception = null; filePath = null; string originalClassName = string.Format("{0}Class", uniqueName); string coreAssembly = typeof(ISerializedObject).Assembly.Location; var domain = AppDomain.CreateDomain(string.Format("{0}Domain", uniqueName)); bool success = true; try { // Create an instance of the color struct, so the core library is loaded. domain.CreateInstanceFrom(coreAssembly, "CryEngine.Color"); string generateResult; bool compiled = GenerateAssembly(coreAssembly, originalClassName, stringValue, intValue, floatValue, out generateResult); if (!compiled) { throw new CryEngine.Compilation.CompilationFailedException(string.Format("Failed to compile the source code!\n{0}", generateResult), new string[0], 0); } filePath = generateResult; var handle = domain.CreateInstanceFrom(filePath, "Serializer"); var serializer = handle.Unwrap() as ISerializedObject; if (serializer == null) { throw new NullReferenceException("Getting the Serializer returned null!"); } success = processDataAction(serializer, ref data); } catch (Exception ex) { exception = ex; success = false; } AppDomain.Unload(domain); return(success); }