private async Task PerformPluginTypeDescription(string folder, PluginTypeFullInfo pluginType) { var handler = new PluginTypeConfigurationDescriptionHandler(); string description = await handler.CreateDescriptionAsync(pluginType.PluginType); if (!string.IsNullOrEmpty(description)) { string fileName = string.Format( _formatFileTxt , Path.GetFileNameWithoutExtension(pluginType.PluginDescription.FilePath) , pluginType.PluginType.TypeName); StringBuilder content = new StringBuilder(); content.AppendLine(pluginType.PluginDescription.GetConnectionInfo()).AppendLine(); content.AppendFormat("Plugin Steps for PluginType '{0}'", pluginType.PluginType.TypeName).AppendLine(); content.Append(description); string filePath = Path.Combine(folder, FileOperations.RemoveWrongSymbols(fileName)); File.WriteAllText(filePath, content.ToString(), new UTF8Encoding(false)); this._iWriteToOutput.WriteToOutput(null, "PluginType {0} description exported to {1}", pluginType.PluginType.TypeName, filePath); this._iWriteToOutput.PerformAction(null, filePath); } else { this._iWriteToOutput.WriteToOutput(null, "PluginType {0} description is empty.", pluginType.PluginType.TypeName); } }
private async Task CreateDescription(StepFullInfo node) { if (node.PluginType == null) { return; } this._iWriteToOutput.WriteToOutputStartOperation(null, Properties.OperationNames.CreatingFileWithDescription); ToggleControls(null, false, Properties.OutputStrings.CreatingDescription); StringBuilder result = new StringBuilder(); string fileName = string.Empty; if (node.PluginType != null) { const string _formatFileTxt = "{0} {1} - Description.txt"; fileName = string.Format( _formatFileTxt , Path.GetFileNameWithoutExtension(node.PluginDescription.FilePath) , node.PluginType.TypeName); if (result.Length > 0) { result.AppendLine().AppendLine().AppendLine(); } { PluginTypeConfigurationDescriptionHandler handler = new PluginTypeConfigurationDescriptionHandler(); var desc = await handler.CreateDescriptionAsync(node.PluginType); if (!string.IsNullOrEmpty(desc)) { if (result.Length > 0) { result.AppendLine().AppendLine().AppendLine(); } result.AppendLine(desc); } } } if (!string.IsNullOrEmpty(fileName)) { string filePath = Path.Combine(_commonConfig.FolderForExport, FileOperations.RemoveWrongSymbols(fileName)); File.WriteAllText(filePath, result.ToString(), new UTF8Encoding(false)); this._iWriteToOutput.PerformAction(null, filePath); } ToggleControls(null, true, Properties.OutputStrings.CreatingDescriptionCompleted); this._iWriteToOutput.WriteToOutputEndOperation(null, Properties.OperationNames.CreatingFileWithDescription); }