public IFileInfo GetFileInfos(string subpath, IModuleEntry module) { if (!_fileInfos.TryGetValue(subpath, out var fileInfo)) { //if (!assetPaths.Contains(_root + subpath, StringComparer.Ordinal)) //{ // return new NotFoundFileInfo(subpath); //} lock (_fileInfos) { if (!_fileInfos.TryGetValue(subpath, out fileInfo)) { var resourcePath = _baseNamespace + subpath.Replace('/', '>'); var fileName = Path.GetFileName(subpath); if (module.Assembly.GetManifestResourceInfo(resourcePath) == null) { return(new NotFoundFileInfo(fileName)); } _fileInfos[subpath] = fileInfo = new EmbeddedResourceFileInfo( module.Assembly, resourcePath, fileName, DateTime.Now); } } } return(fileInfo); }
public Guid CreateNewModule(IModuleDefinitionCreate moduleDefinition) { IModuleEntry moduleEntry = null; using (var transaction = uow.BeginTransaction()) { // Load parent task var taskEntry = engineRepository.GetTaskById(moduleDefinition.ParentTaskId); // Check if parent task exists if (taskEntry == null) { throw new EngineException(logger, "Error creating new module. The parent task not exists."); } // get the engine element IEngineModule engineModule = GetEngineModule(moduleDefinition.ModuleTypeKey); // Get the right entry model for this engine element type moduleEntry = (IModuleEntry)engineModule.GetEmptyEntity(); // Populate the entry module whit data provided by user moduleEntry.Name = moduleDefinition.Name; moduleEntry.Description = moduleDefinition.Description; moduleEntry.IsEnabled = true; moduleEntry.ParentTask = taskEntry; // create the element in db engineRepository.CreateModule(moduleEntry); } return(moduleEntry.Id); }
public void EditModule(Guid moduleId, IModuleDefinitionEdit moduleDefinition) { IModuleEntry entry = null; using (var transaction = uow.BeginTransaction()) { entry = engineRepository.GetModuleById(moduleId); entry.Name = moduleDefinition.Name; entry.Description = moduleDefinition.Description; foreach (var inputProperty in moduleDefinition.InputProperties) { var entryProperty = entry.InputProperties.FirstOrDefault(p => p.Key == inputProperty.Key); var data = GetPopertyDataValue(entryProperty); data.ReadFromStringValue(inputProperty.Value.Base64Decode()); entryProperty.Value = data.WriteToStringValue(); } foreach (var outputProperties in moduleDefinition.OutputProperties) { var entryProperty = entry.OutputProperties.FirstOrDefault(p => p.Key == outputProperties.Key); var data = GetPopertyDataValue(entryProperty); data.ReadFromStringValue(outputProperties.Value.Base64Decode()); entryProperty.Value = data.WriteToStringValue(); } if (moduleDefinition.ParentTaskId != null && moduleDefinition.ParentTaskId != entry.ParentTask.Id) { var parentTask = engineRepository.GetTaskById((Guid)moduleDefinition.ParentTaskId); entry.ParentTask = parentTask; } engineRepository.UpdateModule(entry); } }
private void RegisterModuleViews(IModuleEntry module) { var views = module.Views; var settings = module.SettingViews; foreach (var view in views.Union(settings)) { InternalRegisterView(view); } }
/* Methods */ public void AddModule(IModuleEntry module) { if (module == null) { return; } RegisterModuleViews(module); _moduleEntries.Add(module); }
public override void LoadFromEntity(Guid EntityId) { moduleEntry = engineRepository.GetModuleById(EntityId); foreach (var inputProperty in moduleEntry.InputProperties) { SetDataValueIfEmpty(EngineDataDirection.Input, inputProperty.Key, inputProperty.DataType, inputProperty.Value); } foreach (var outputProperty in moduleEntry.OutputProperties) { SetDataValueIfEmpty(EngineDataDirection.Output, outputProperty.Key, outputProperty.DataType, outputProperty.Value); } }
public ShellFeature(IModuleEntry entry) { ModuleId = entry.Descriptor.Id; Descriptor = entry.Descriptor; Version = entry.Descriptor.Version; // Add minimal set of dependencies var dependencies = new List <ShellFeature>(); foreach (var dependency in entry.Descriptor.Dependencies) { dependencies.Add(new ShellFeature(dependency)); } this.Dependencies = dependencies; }
public ModuleDefinition(IModuleEntry moduleEntry, IModuleConfig moduleConfiguration) { if (moduleEntry == null) { throw new ArgumentNullException(nameof(moduleEntry)); } if (moduleConfiguration == null) { throw new ArgumentNullException(nameof(moduleConfiguration)); } this.moduleEntry = moduleEntry; this.moduleConfiguration = moduleConfiguration; if (moduleConfiguration.ImplementationType == null) { this.comparableImplementationType = string.Empty; } else { this.comparableImplementationType = Regex.Replace(moduleConfiguration.ImplementationType, @"\s", string.Empty); } }
void TryAdd(Type type, IModuleEntry module) { _modules.TryAdd(type, module); }
public void UpdateModule(IModuleEntry entry) { base.Update((ModuleEntry)entry); }
public void CreateModule(IModuleEntry moduleEntry) { base.Create((ModuleEntry)moduleEntry); }