2024-09-01 20:47:02 +02:00
|
|
|
|
using DevExpress.Pdf;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BeWo.Service.Import
|
|
|
|
|
|
{
|
|
|
|
|
|
public class TextAbschnittReader
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2025-10-24 01:56:35 +02:00
|
|
|
|
public static TextAbschnitt LeseBisText(string[] lines, int index, String suchText, bool sucheAmZeilenAnfang, bool sucheInnerhalbDerZeile, bool sucheAmZeilenEnde, IList<String> ignoreLines = null)
|
2024-09-01 20:47:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
var ta = new TextAbschnitt();
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
ta.ZeilenIndex = index;
|
2025-10-24 01:56:35 +02:00
|
|
|
|
|
|
|
|
|
|
if (ignoreLines == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
ignoreLines = new List<String>();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-09-01 20:47:02 +02:00
|
|
|
|
while (index < lines.Length)
|
|
|
|
|
|
{
|
|
|
|
|
|
String line = lines[index];
|
|
|
|
|
|
sb.AppendLine(line);
|
|
|
|
|
|
|
2025-10-24 01:56:35 +02:00
|
|
|
|
if (((sucheAmZeilenAnfang && line.StartsWith(suchText)) || (sucheInnerhalbDerZeile && line.Contains(suchText)) || (sucheAmZeilenEnde && line.EndsWith(suchText))) && !ignoreLines.Contains(line))
|
2024-09-01 20:47:02 +02:00
|
|
|
|
{
|
|
|
|
|
|
ta.Success = true;
|
|
|
|
|
|
ta.ZeilenIndex = index;
|
|
|
|
|
|
ta.Text = sb.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
return ta;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
index++;
|
|
|
|
|
|
}
|
|
|
|
|
|
return ta;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|