private async Task LogProgressAsync(ConversionResult convertedFile, List <string> errors) { var exceptionsAsString = convertedFile.GetExceptionsAsString(); var indentedException = exceptionsAsString.Replace(Environment.NewLine, Environment.NewLine + " ").TrimEnd(); var targetPathRelativeToSolutionDir = PathRelativeToSolutionDir(convertedFile.TargetPathOrNull ?? "unknown"); string output = $"* {targetPathRelativeToSolutionDir}"; var containsErrors = !string.IsNullOrWhiteSpace(exceptionsAsString); if (containsErrors) { errors.Add(exceptionsAsString); } if (string.IsNullOrWhiteSpace(convertedFile.ConvertedCode)) { var sourcePathRelativeToSolutionDir = PathRelativeToSolutionDir(convertedFile.SourcePathOrNull ?? "unknown"); output = $"* Failure processing {sourcePathRelativeToSolutionDir}{Environment.NewLine} {indentedException}"; } else if (containsErrors) { output += $" contains errors{Environment.NewLine} {indentedException}"; } await _outputWindow.WriteToOutputWindowAsync(Environment.NewLine + output); }
private void LogError(string solutionDir, ConversionResult convertedFile) { var indentedException = convertedFile.GetExceptionsAsString().Replace(Environment.NewLine, Environment.NewLine + " "); VisualStudioInteraction.OutputWindow.WriteToOutputWindow(Environment.NewLine + $"* Error processing {PathRelativeToSolutionDir(solutionDir, convertedFile.SourcePathOrNull ?? "")}{Environment.NewLine} {indentedException}" ); }
private static void AssertConvertedCodeResultEquals(ConversionResult conversionResult, string expectedConversionResultText, string originalSource) { var convertedTextFollowedByExceptions = (conversionResult.ConvertedCode ?? "") + (conversionResult.GetExceptionsAsString() ?? ""); var txt = Utils.HomogenizeEol(convertedTextFollowedByExceptions).TrimEnd(); expectedConversionResultText = Utils.HomogenizeEol(expectedConversionResultText).TrimEnd(); AssertCodeEqual(originalSource, expectedConversionResultText, txt); }
private void LogProgress(ConversionResult convertedFile, List <string> errors, string sourcePathRelativeToSolutionDir) { var exceptionsAsString = convertedFile.GetExceptionsAsString(); var indentedException = exceptionsAsString.Replace(Environment.NewLine, Environment.NewLine + " "); string output = Environment.NewLine + $"* {ToggleExtension(sourcePathRelativeToSolutionDir)}"; var containsErrors = !string.IsNullOrWhiteSpace(exceptionsAsString); if (containsErrors) { errors.Add(exceptionsAsString); } if (string.IsNullOrWhiteSpace(convertedFile.ConvertedCode)) { output = Environment.NewLine + $"* Failure processing {sourcePathRelativeToSolutionDir}{Environment.NewLine} {indentedException}"; } else if (containsErrors) { output += $" contains errors{Environment.NewLine} {indentedException}"; } VisualStudioInteraction.OutputWindow.WriteToOutputWindow(output); }