public async Task <string> CreateDescriptionAsync(Guid idPluginAssembly, string name, DateTime now) { var content = new StringBuilder(); var allTypes = await _repType.GetPluginTypesAsync(idPluginAssembly); var allSteps = await _repStep.GetAllStepsByPluginAssemblyAsync(idPluginAssembly); var allImages = await _repImage.GetImagesByPluginAssemblyAsync(idPluginAssembly); var allSecure = await _repSecure.GetAllSdkMessageProcessingStepSecureConfigAsync(); content.AppendLine(_connectionInfo).AppendLine(); content.AppendFormat("Description for PluginAssembly '{0}' at {1}", name, now.ToString("G", System.Globalization.CultureInfo.CurrentCulture)).AppendLine(); content .AppendLine() .AppendLine("Plugin Types"); foreach (var pluginType in allTypes.OrderBy(e => e.TypeName)) { content.AppendLine(pluginType.TypeName); } content .AppendLine() .AppendLine("Plugin Types Descriptions"); foreach (var pluginType in allTypes.OrderBy(e => e.TypeName)) { var desc = await PluginTypeDescriptionHandler.CreateDescriptionAsync(pluginType.PluginTypeId.Value , allSteps.Where(s => s.EventHandler.Id == pluginType.PluginTypeId.Value) , allImages , allSecure ); if (!string.IsNullOrEmpty(desc)) { content.AppendFormat("Plugin Steps for PluginType '{0}'", pluginType.TypeName).AppendLine(); content.AppendLine(desc).AppendLine(); } } return(content.ToString()); }
private static bool CreateFileWithDescription(string connectionInfo, string filePath, Guid idPluginType, string pluginTypeName, List <SdkMessageProcessingStep> allSteps, List <SdkMessageProcessingStepImage> queryImage, List <SdkMessageProcessingStepSecureConfig> listSecure) { string description = PluginTypeDescriptionHandler.CreateDescription(idPluginType, allSteps, queryImage, listSecure); if (string.IsNullOrEmpty(description)) { return(false); } StringBuilder content = new StringBuilder(); content.AppendLine(connectionInfo).AppendLine(); content.AppendFormat("Plugin Steps for PluginType '{0}' at {1}", pluginTypeName, DateTime.Now.ToString("G", System.Globalization.CultureInfo.CurrentCulture)).AppendLine(); content.Append(description); File.WriteAllText(filePath, content.ToString(), new UTF8Encoding(false)); return(true); }