//public async Task<IPluginsSynchronizeContextScoped> GetSynchronizeContextScopedAsync() //{ // return await Task.FromResult<IPluginsSynchronizeContextScoped>(new FileDataSynchronizeContextScopedImp()); //} private ILogger GetLogger(IPluginServiceManager pluginServiceManager) { ILogger logger = pluginServiceManager.GetService <ILogger>(typeof(ILogger)); logger.LogDebug("Hi from raw file reader"); return(logger); }
public async Task <IProcessingContext> ExecuteAsync(LoadedNodeSet loaderContext, IProcessingContext processingContext, IPluginServiceManager pluginServiceManager, IPluginsSynchronizeContextScoped contextScoped, INode currentNode) { if (currentNode is View view) { string cacheKey = processingContext.InputModel.Module + processingContext.InputModel.NodeSet + processingContext.InputModel.Nodepath + view.BindingKey + "_View"; ICachingService cachingService = pluginServiceManager.GetService <ICachingService>(typeof(ICachingService)); string cachedView = cachingService.Get <string>(cacheKey); if (cachedView == null) { string directoryPath = Path.Combine( processingContext.InputModel.KraftGlobalConfigurationSettings.GeneralSettings.ModulesRootFolder, processingContext.InputModel.Module, "Views"); PhysicalFileProvider fileProvider = new PhysicalFileProvider(directoryPath); cachedView = File.ReadAllText(Path.Combine(directoryPath, view.Settings.Path)); cachingService.Insert(cacheKey, cachedView, fileProvider.Watch(view.Settings.Path)); } IResourceModel resourceModel = new ResourceModel(); resourceModel.Content = cachedView; resourceModel.SId = $"node/view/{processingContext.InputModel.Module}/{processingContext.InputModel.NodeSet}/{processingContext.InputModel.Nodepath}/{view.BindingKey}"; processingContext.ReturnModel.Views.Add(view.BindingKey, resourceModel); } else { processingContext.ReturnModel.Status.StatusResults.Add(new StatusResult { StatusResultType = EStatusResult.StatusResultError, Message = "Current node is null or not OfType(View)" }); throw new InvalidDataException("HtmlViewSynchronizeContextLocalImp.CurrentNode is null or not OfType(View)"); } return(await Task.FromResult(processingContext)); }
public async Task <IProcessingContext> ExecuteAsync( LoadedNodeSet loaderContext, IProcessingContext processingContext, IPluginServiceManager pluginServiceManager, IPluginsSynchronizeContextScoped contextScoped, INode currentNode) { IHttpContextAccessor httpContextAccessor = pluginServiceManager.GetService <IHttpContextAccessor>(typeof(HttpContextAccessor)); HttpRequest request = httpContextAccessor.HttpContext.Request; UploadFileBase uploadFile; if (request.ContentLength == null && request.Headers["Transfer-Encoding"] == "chunked") { uploadFile = new UploadFileForm(); } else { uploadFile = new UploadFileMultipart(); } return(await uploadFile.Execute(request, processingContext)); }