public static QifConversionResult ConvertTextToQif(FormatType.FormatTypeEnum formatType, List<string> inputLines) { var conversionResult = new QifConversionResult {Header = GetQifHeader(formatType)}; ConvertLinesToQif(formatType, inputLines, conversionResult); conversionResult.Success = conversionResult.FailedLines.Count < 1; return conversionResult; }
public QifConversionResult ConvertText(List<string> inputLines) { var result = new QifConversionResult(); var parser = ParserFactory.GetParser(_formatType); var parseResult = parser.ParseLines(inputLines); var outputCreator = new QifOutputCreator(); result.Output = outputCreator.CreateOutput(parseResult, _formatType); result.Success = true; return result; }
private static void ConvertLinesToQif(FormatType.FormatTypeEnum formatType, IEnumerable<string> inputLines, QifConversionResult conversionResult) { var regex = GetRegexForFormatType(formatType); foreach (var inputLine in inputLines) { if(string.IsNullOrWhiteSpace(inputLine)) continue; var match = regex.Match(inputLine); if (match.Success) { string qifText = ConvertMatchToQif(formatType, match); if (qifText == null) return; conversionResult.OutputLines.Append(qifText); } else { conversionResult.FailedLines.Add(inputLine); } } }